<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Help using pty in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802984#M100366</link>
    <description>I tried to create the function open_pty and i get the following error when i compile in HPUX 11.11:&lt;BR /&gt;error 1588: "I_PUSH" undefined.&lt;BR /&gt;at this line&lt;BR /&gt;ioctl(Sfd, I_PUSH, "ptem");</description>
    <pubDate>Tue, 13 Jun 2006 00:25:24 GMT</pubDate>
    <dc:creator>Andreas Tsamis</dc:creator>
    <dc:date>2006-06-13T00:25:24Z</dc:date>
    <item>
      <title>Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802982#M100364</link>
      <description>I have the following c code to change a password in hpux. I run (as&lt;BR /&gt;root) it but the password doesn't change. Do i do something wrong when&lt;BR /&gt;passing the argument to the master pty?&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;FCNTL.H&gt;&lt;BR /&gt;#include &lt;ERRNO.H&gt;&lt;BR /&gt;#include &lt;UNISTD.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;DIRENT.H&gt;&lt;BR /&gt;&lt;BR /&gt;void ErrorExit(char *msg)&lt;BR /&gt;{&lt;BR /&gt;   perror(msg);&lt;BR /&gt;   exit(EXIT_FAILURE);&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int main( int argc, char *argv[] )&lt;BR /&gt;{&lt;BR /&gt;   int slaveFd, len, stat,opened=0,infd;&lt;BR /&gt;   pid_t child;&lt;BR /&gt;   char ptyMaster[200],ptySlave[200],tempSlave[200];&lt;BR /&gt;   char Buf[80];&lt;BR /&gt;   DIR *dirp;&lt;BR /&gt;   struct dirent *dp;&lt;BR /&gt;   char passwordis[100];&lt;BR /&gt;&lt;BR /&gt;   if (argc &amp;lt; 2)&lt;BR /&gt;   {&lt;BR /&gt;      fputs("usage: pty-passwd user\n", stderr);&lt;BR /&gt;      return EXIT_FAILURE;&lt;BR /&gt;   }&lt;BR /&gt;   if (strlen(argv[1]) &amp;gt; 8)&lt;BR /&gt;   {&lt;BR /&gt;      fputs("username too long\n", stderr);&lt;BR /&gt;      return EXIT_FAILURE;&lt;BR /&gt;   }&lt;BR /&gt;    dirp=opendir("/dev/ptym");&lt;BR /&gt;&lt;BR /&gt;   while ((dp = readdir(dirp)) !=NULL) {&lt;BR /&gt;        strcpy(ptyMaster,"/dev/ptym/");&lt;BR /&gt;        strcat(ptyMaster,dp-&amp;gt;d_name);&lt;BR /&gt;        strcpy(ptySlave,"/dev/pty/");&lt;BR /&gt;        strcpy(tempSlave,dp-&amp;gt;d_name);&lt;BR /&gt;        tempSlave[0] = 't';&lt;BR /&gt;        strcat(ptySlave,tempSlave);&lt;BR /&gt;        infd = open(ptyMaster, O_RDWR,0);&lt;BR /&gt;        if (infd != -1)  {&lt;BR /&gt;            opened=1;&lt;BR /&gt;            break;&lt;BR /&gt;        }&lt;BR /&gt;    }&lt;BR /&gt;    closedir(dirp);&lt;BR /&gt;    if (opened==0) {&lt;BR /&gt;        fprintf(stderr, "Unable To Attach To Any PTY\n");&lt;BR /&gt;        exit(-1);&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    if ((child = fork()) &amp;lt; 0)&lt;BR /&gt;        ErrorExit("fork");&lt;BR /&gt;&lt;BR /&gt;   if (child &amp;gt; (pid_t) 0)&lt;BR /&gt;   {&lt;BR /&gt;      /* in parent */&lt;BR /&gt;      printf("In Parent\n");&lt;BR /&gt;      strcpy(passwordis,"welcom\n");&lt;BR /&gt;      sleep(2);&lt;BR /&gt;      write(infd, passwordis, strlen(passwordis));&lt;BR /&gt;      sleep(3);&lt;BR /&gt;      write(infd, passwordis, strlen(passwordis));&lt;BR /&gt;      sleep(2);&lt;BR /&gt;      wait(&amp;amp;stat);&lt;BR /&gt;      return WEXITSTATUS(stat);&lt;BR /&gt;     //waitpid(child,NULL,0);&lt;BR /&gt;   }&lt;BR /&gt;   else if (child == (pid_t) 0);&lt;BR /&gt;   {&lt;BR /&gt;      /* in child */&lt;BR /&gt;      printf("In Child\n");&lt;BR /&gt;      if (setsid() &amp;lt; 0)&lt;BR /&gt;         ErrorExit("setsid");&lt;BR /&gt;      if ( (slaveFd = open(ptySlave, O_RDWR,0)) &amp;lt; 0)&lt;BR /&gt;         perror("open (slave)");&lt;BR /&gt;      close(infd);&lt;BR /&gt;      if (slaveFd != 0) dup2(slaveFd, 0);&lt;BR /&gt;      if (slaveFd != 1) dup2(slaveFd, 1);&lt;BR /&gt;      if (slaveFd != 2) dup2(slaveFd, 2);&lt;BR /&gt;      close(0);&lt;BR /&gt;      close(1);&lt;BR /&gt;      close(2);&lt;BR /&gt;      /* run passwd */&lt;BR /&gt;       execlp("passwd", "passwd", argv[1], NULL);&lt;BR /&gt;       return(-1);&lt;BR /&gt;    }&lt;BR /&gt;   return EXIT_SUCCESS; &lt;BR /&gt;}&lt;/DIRENT.H&gt;&lt;/SYS&gt;&lt;/SYS&gt;&lt;/SYS&gt;&lt;/STDLIB.H&gt;&lt;/UNISTD.H&gt;&lt;/ERRNO.H&gt;&lt;/FCNTL.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Fri, 09 Jun 2006 02:25:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802982#M100364</guid>
      <dc:creator>Andreas Tsamis</dc:creator>
      <dc:date>2006-06-09T02:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802983#M100365</link>
      <description>You close file descriptors 0, 1, and 2 between the dup2() calls and the execlp() call.  You meant to leave those open.&lt;BR /&gt;&lt;BR /&gt;The business of readdir("/dev/ptym") is not necessary with recent HP-UX releases.  You can open /dev/ptym/clone for a plain pty or /dev/ptmx for a streams pty and call ptsname to get the slave pty name.  The details are discussed in pty(7) and ptm(7).&lt;BR /&gt;&lt;BR /&gt;  The ptm style takes a few more calls to set up termio, but has the advantage of being able to use grantpt() to fix up permissions of the slave pty device file.  Otherwise you need to watch out for slave pty devices that you don't have permission to open.&lt;BR /&gt;&lt;BR /&gt;infd = open("/dev/ptym/clone");&lt;BR /&gt;if (infd == -1) ErrorExit("no pty");&lt;BR /&gt;ptySlave = ptsname(infd);&lt;BR /&gt;&lt;BR /&gt;int open_pty(void)&lt;BR /&gt;{&lt;BR /&gt;    int enable = 1;&lt;BR /&gt;    int Sfd;&lt;BR /&gt;&lt;BR /&gt;    /* Get a master pty */&lt;BR /&gt;#if OLD_PTY&lt;BR /&gt;    Mfd = open("/dev/ptym/clone", O_RDWR);&lt;BR /&gt;#else&lt;BR /&gt;    Mfd = open("/dev/ptmx", O_RDWR);&lt;BR /&gt;#endif&lt;BR /&gt;    if ( Mfd == -1 ) {&lt;BR /&gt;        perror("log: error opening Pty master");&lt;BR /&gt;        exit(1);&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;#if OLD_PTY&lt;BR /&gt;    /* enable pty traping of opens, closes, and ioctls */&lt;BR /&gt;    ioctl(Mfd, TIOCTRAP, &amp;amp;enable);&lt;BR /&gt;&lt;BR /&gt;    Sfd = open(ptsname(Mfd), O_RDWR);&lt;BR /&gt;    if (Sfd == -1) {&lt;BR /&gt;        perror("log: error opening Pty slave");&lt;BR /&gt;        exit(1);&lt;BR /&gt;    }&lt;BR /&gt;#else&lt;BR /&gt;    /* Change the slave pty to be owned by the real user and&lt;BR /&gt;     * group of the login running log, mode rw-rw-rw-.&lt;BR /&gt;     */&lt;BR /&gt;    grantpt(Mfd);&lt;BR /&gt;    unlockpt(Mfd);&lt;BR /&gt;    Sfd = open(ptsname(Mfd), O_RDWR);&lt;BR /&gt;    if (Sfd == -1) {&lt;BR /&gt;        perror("log: error opening Pty slave");&lt;BR /&gt;        exit(1);&lt;BR /&gt;    }&lt;BR /&gt;    ioctl(Sfd, I_PUSH, "ptem");&lt;BR /&gt;    ioctl(Sfd, I_PUSH, "ldterm");&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;    return Sfd;&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2006 17:05:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802983#M100365</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2006-06-09T17:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802984#M100366</link>
      <description>I tried to create the function open_pty and i get the following error when i compile in HPUX 11.11:&lt;BR /&gt;error 1588: "I_PUSH" undefined.&lt;BR /&gt;at this line&lt;BR /&gt;ioctl(Sfd, I_PUSH, "ptem");</description>
      <pubDate>Tue, 13 Jun 2006 00:25:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802984#M100366</guid>
      <dc:creator>Andreas Tsamis</dc:creator>
      <dc:date>2006-06-13T00:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802985#M100367</link>
      <description>if i ommit the ioctl calls with I_PUSH the program runs but the password doesn't change</description>
      <pubDate>Tue, 13 Jun 2006 02:14:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802985#M100367</guid>
      <dc:creator>Andreas Tsamis</dc:creator>
      <dc:date>2006-06-13T02:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802986#M100368</link>
      <description>You should use these includes to use the&lt;BR /&gt;/dev/ptmx interface.&lt;BR /&gt;      #include &lt;SYS&gt;&lt;BR /&gt;      #include &lt;SYS&gt;&lt;BR /&gt;      #include &lt;SYS&gt;&lt;BR /&gt;They are listed in "man ptm".  That will&lt;BR /&gt;provide a definition for I_PUSH.&lt;BR /&gt;&lt;BR /&gt;Did you also remove the close calls after&lt;BR /&gt;setting file descriptors 0, 1, and 2, to&lt;BR /&gt;use the slave pty?&lt;/SYS&gt;&lt;/SYS&gt;&lt;/SYS&gt;</description>
      <pubDate>Wed, 14 Jun 2006 17:34:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802986#M100368</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2006-06-14T17:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802987#M100369</link>
      <description>I removed the close calls but still when the program runs it o/p on screen the two welcom messages exits but the password doesn't change.</description>
      <pubDate>Thu, 15 Jun 2006 00:06:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802987#M100369</guid>
      <dc:creator>Andreas Tsamis</dc:creator>
      <dc:date>2006-06-15T00:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802988#M100370</link>
      <description>man getpwent&lt;BR /&gt;&lt;BR /&gt;You should use the supported built-in system calls to read and write password file entries and not try to do it yourself.  What if you used shadow passwords or trusted mode?  Your program also will not set any password because you are not using crypt() to encrypt a given password and salt into the passwd.pw_passwd entry.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Jun 2006 05:47:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802988#M100370</guid>
      <dc:creator>Steve Lewis</dc:creator>
      <dc:date>2006-06-15T05:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802989#M100371</link>
      <description>The password part will be part of a bigger program that will need to use ptys. The concept with ptys works if i use expect (i think it uses ptys also) in a script.</description>
      <pubDate>Thu, 15 Jun 2006 05:55:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802989#M100371</guid>
      <dc:creator>Andreas Tsamis</dc:creator>
      <dc:date>2006-06-15T05:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802990#M100372</link>
      <description>Andreas,&lt;BR /&gt;&lt;BR /&gt;  I confirmed that commenting out the close calls in your original code produced a program that worked to change a password when run as root.&lt;BR /&gt;&lt;BR /&gt;  You can check what is happening by using the tusc command to trace system calls.  Get tusc from the download mentioned at&lt;BR /&gt;&lt;A href="http://h20331.www2.hp.com/Hpsub/cache/286022-0-0-225-121.html" target="_blank"&gt;http://h20331.www2.hp.com/Hpsub/cache/286022-0-0-225-121.html&lt;/A&gt;&lt;BR /&gt;and run it as root like&lt;BR /&gt;tusc -fp a.out acctname&lt;BR /&gt;to see what system calls are made by your program and the passwd process.  (That gives a way to see error messages written to stderr that are going to the slave pty.)</description>
      <pubDate>Fri, 16 Jun 2006 11:22:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802990#M100372</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2006-06-16T11:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802991#M100373</link>
      <description>i tried tusc and it seems that it just waits indefenitely&lt;BR /&gt;This is part of tusc o/p&lt;BR /&gt;&lt;BR /&gt;getdents(3, 0x400031c0, 8192) ............................ = 1512&lt;BR /&gt;open("/dev/ptym/.", O_RDWR, 0) ........................... ERR#21 EISDIR&lt;BR /&gt;open("/dev/ptym/..", O_RDWR, 0) .......................... ERR#21 EISDIR&lt;BR /&gt;open("/dev/ptym/ptyp0", O_RDWR, 0) ....................... ERR#16 EBUSY&lt;BR /&gt;open("/dev/ptym/ptyp1", O_RDWR, 0) ....................... = 4&lt;BR /&gt;close(3) ................................................. = 0&lt;BR /&gt;fork() ................................................... = 27568&lt;BR /&gt;In Child&lt;BR /&gt;ioctl(1, TCGETA, 0x7f7f0ef8) ............................. = 0&lt;BR /&gt;In Parent&lt;BR /&gt;write(1, "I n   P a r e n t \n", 10) ..................... = 10&lt;BR /&gt;sigprocmask(SIG_BLOCK, 0x7f7f0c48, 0x7f7f0c68) ........... = 0&lt;BR /&gt;getitimer(ITIMER_REAL, 0x7f7f0c88) ....................... = 0&lt;BR /&gt;time(NULL) ............................................... = 1152515660&lt;BR /&gt;sigtimedwait(0x7f7f0c98, NULL, 0x7f7f0cb8) ............... [sleeping]&lt;BR /&gt;sigtimedwait(0x7f7f0c98, NULL, 0x7f7f0cb8) ............... ERR#11 EAGAIN&lt;BR /&gt;time(NULL) ............................................... = 1152515662&lt;BR /&gt;sigprocmask(SIG_SETMASK, 0x7f7f0c68, NULL) ............... = 0&lt;BR /&gt;write(4, "w e l c o m \n", 7) ............................ = 7&lt;BR /&gt;sigprocmask(SIG_BLOCK, 0x7f7f0c48, 0x7f7f0c68) ........... = 0&lt;BR /&gt;getitimer(ITIMER_REAL, 0x7f7f0c88) ....................... = 0&lt;BR /&gt;time(NULL) ............................................... = 1152515662&lt;BR /&gt;sigtimedwait(0x7f7f0c98, NULL, 0x7f7f0cb8) ............... [sleeping]&lt;BR /&gt;sigtimedwait(0x7f7f0c98, NULL, 0x7f7f0cb8) ............... ERR#11 EAGAIN&lt;BR /&gt;time(NULL) ............................................... = 1152515665&lt;BR /&gt;sigprocmask(SIG_SETMASK, 0x7f7f0c68, NULL) ............... = 0&lt;BR /&gt;write(4, "w e l c o m \n", 7) ............................ = 7&lt;BR /&gt;sigprocmask(SIG_BLOCK, 0x7f7f0c48, 0x7f7f0c68) ........... = 0&lt;BR /&gt;getitimer(ITIMER_REAL, 0x7f7f0c88) ....................... = 0&lt;BR /&gt;time(NULL) ............................................... = 1152515665&lt;BR /&gt;sigtimedwait(0x7f7f0c98, NULL, 0x7f7f0cb8) ............... [sleeping]&lt;BR /&gt;sigtimedwait(0x7f7f0c98, NULL, 0x7f7f0cb8) ............... ERR#11 EAGAIN&lt;BR /&gt;time(NULL) ............................................... = 1152515667&lt;BR /&gt;sigprocmask(SIG_SETMASK, 0x7f7f0c68, NULL) ............... = 0&lt;BR /&gt;wait(0x7f7f08a8) ......................................... [sleeping]</description>
      <pubDate>Mon, 10 Jul 2006 02:28:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802991#M100373</guid>
      <dc:creator>Andreas Tsamis</dc:creator>
      <dc:date>2006-07-10T02:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802992#M100374</link>
      <description>The tusc output shows that the parent process has done the writes and is waiting for the child process to exit.  You didn't give tusc the "-fp" option, so it doesn't show what the child process is doing.&lt;BR /&gt;</description>
      <pubDate>Mon, 10 Jul 2006 16:09:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802992#M100374</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2006-07-10T16:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802993#M100375</link>
      <description>This is part of the o/p tusc -fp passwd ... It seems that i get prompted to enter new password but it doesn't accept welcom as input. It should prompted me to reenter the pass. &lt;BR /&gt;[1862] lseek(4, 2444, SEEK_SET) .......................... = 2444&lt;BR /&gt;[1862] read(4, "N e w   p a s s w o r d :   ", 14) ....... = 14&lt;BR /&gt;[1862] open("/dev/tty", O_RDWR, 0666) .................... = 5&lt;BR /&gt;[1862] ioctl(5, TCGETA, 0x7f7fe2e8) ...................... = 0&lt;BR /&gt;[1862] sigsetreturn(0x7b038fee, 0x6211988, 1392) ......... = 0&lt;BR /&gt;[1862] sigvec(SIGINT, 0x7f7fde20, 0x7f7fde30) ............ = 0&lt;BR /&gt;[1862] ioctl(5, TCGETA, 0x7f7fdda0) ...................... = 0&lt;BR /&gt;[1861] sigtimedwait(0x7f7f0c88, NULL, 0x7f7f0ca8) ........ ERR#11 EAGAIN&lt;BR /&gt;[1861] time(NULL) ........................................ = 1152591374&lt;BR /&gt;[1861] sigprocmask(SIG_SETMASK, 0x7f7f0c58, NULL) ........ = 0&lt;BR /&gt;[1861] write(4, "w e l c o m \n", 7) ..................... = 7&lt;BR /&gt;[1861] sigprocmask(SIG_BLOCK, 0x7f7f0c38, 0x7f7f0c58) .... = 0&lt;BR /&gt;[1861] getitimer(ITIMER_REAL, 0x7f7f0c78) ................ = 0&lt;BR /&gt;[1861] time(NULL) ........................................ = 1152591374&lt;BR /&gt;[1861] sigtimedwait(0x7f7f0c88, NULL, 0x7f7f0ca8) ........ [sleeping]&lt;BR /&gt;[1861] sigtimedwait(0x7f7f0c88, NULL, 0x7f7f0ca8) ........ ERR#11 EAGAIN&lt;BR /&gt;[1861] time(NULL) ........................................ = 1152591377&lt;BR /&gt;[1861] sigprocmask(SIG_SETMASK, 0x7f7f0c58, NULL) ........ = 0&lt;BR /&gt;[1861] write(4, "w e l c o m \n", 7) ..................... = 7&lt;BR /&gt;[1861] sigprocmask(SIG_BLOCK, 0x7f7f0c38, 0x7f7f0c58) .... = 0&lt;BR /&gt;[1861] getitimer(ITIMER_REAL, 0x7f7f0c78) ................ = 0&lt;BR /&gt;[1861] time(NULL) ........................................ = 1152591377&lt;BR /&gt;[1861] sigtimedwait(0x7f7f0c88, NULL, 0x7f7f0ca8) ........ ERR#11 EAGAIN&lt;BR /&gt;[1861] time(NULL) ........................................ = 1152591379&lt;BR /&gt;[1861] sigprocmask(SIG_SETMASK, 0x7f7f0c58, NULL) ........ = 0&lt;BR /&gt;[1861] wait(0x7f7f0898) .................................. [sleeping]&lt;BR /&gt;</description>
      <pubDate>Mon, 10 Jul 2006 23:27:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802993#M100375</guid>
      <dc:creator>Andreas Tsamis</dc:creator>
      <dc:date>2006-07-10T23:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802994#M100376</link>
      <description>I don't see the child process prompting for the new password.  It reads that string out of a file; probably from the message catalog /usr/lib/nls/C/pam_unix.cat.  It does a couple of ioctl calls on /dev/tty.  But then it doesn't write any prompt.  Perhaps it was stopped by an unexpected result from the last ioctl.</description>
      <pubDate>Tue, 11 Jul 2006 17:33:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802994#M100376</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2006-07-11T17:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802995#M100377</link>
      <description>You where right. I changed execlp&lt;BR /&gt;to  execlp("/sbin/passwd", "/sbin/passwd", argv[1], NULL);&lt;BR /&gt;and now it reads /etc/passwd and it writes a new password prompt but it still waits &lt;BR /&gt;[6592] open("/dev/tty", O_RDONLY, 0666) .................. = 3&lt;BR /&gt;[6592] ioctl(3, TCGETA, 0x7f7f0ee8) ...................... = 0&lt;BR /&gt;[6592] sigsetreturn(0x2fc98, 0x6211988, 1392) ............ = 0&lt;BR /&gt;[6592] sigaction(SIGINT, 0x7f7f0920, 0x7f7f0948) ......... = 0&lt;BR /&gt;[6592] ioctl(3, TCGETATTR, 0x7f7f0970) ................... = 0&lt;BR /&gt;[6592] ioctl(3, TCSETATTRF, 0x7f7f0970) .................. = 0&lt;BR /&gt;[6592] write(2, "N e w   p a s s w o r d : ", 13) ........ = 13&lt;BR /&gt;[6591] sigtimedwait(0x7f7f0c88, NULL, 0x7f7f0ca8) ........ ERR#11 EAGAIN&lt;BR /&gt;[6591] time(NULL) ........................................ = 1152679755&lt;BR /&gt;[6591] sigprocmask(SIG_SETMASK, 0x7f7f0c58, NULL) ........ = 0&lt;BR /&gt;[6592] read(3, "w ", 1) .................................. = 1&lt;BR /&gt;[6591] write(4, "w e l c o m \r", 7) ..................... = 7&lt;BR /&gt;[6592] read(3, "e ", 1) .................................. = 1&lt;BR /&gt;[6591] sigprocmask(SIG_BLOCK, 0x7f7f0c38, 0x7f7f0c58) .... = 0&lt;BR /&gt;[6592] read(3, "l ", 1) .................................. = 1&lt;BR /&gt;[6591] getitimer(ITIMER_REAL, 0x7f7f0c78) ................ = 0&lt;BR /&gt;[6592] read(3, "c ", 1) .................................. = 1&lt;BR /&gt;[6591] time(NULL) ........................................ = 1152679755&lt;BR /&gt;[6592] read(3, "o ", 1) .................................. = 1&lt;BR /&gt;[6592] read(3, "m ", 1) .................................. = 1&lt;BR /&gt;[6592] read(3, "\r", 1) .................................. = 1&lt;BR /&gt;[6592] read(3, 0x400081c8, 1) ............................ [sleeping]&lt;BR /&gt;[6591] sigtimedwait(0x7f7f0c88, NULL, 0x7f7f0ca8) ........ ERR#11 EAGAIN&lt;BR /&gt;[6591] time(NULL) ........................................ = 1152679758&lt;BR /&gt;[6591] sigprocmask(SIG_SETMASK, 0x7f7f0c58, NULL) ........ = 0&lt;BR /&gt;[6591] write(4, "w e l c o m \r", 7) ..................... = 7&lt;BR /&gt;[6592] read(3, "w ", 1) .................................. = 1&lt;BR /&gt;[6591] sigprocmask(SIG_BLOCK, 0x7f7f0c38, 0x7f7f0c58) .... = 0&lt;BR /&gt;[6592] read(3, "e ", 1) .................................. = 1&lt;BR /&gt;[6591] getitimer(ITIMER_REAL, 0x7f7f0c78) ................ = 0&lt;BR /&gt;[6592] read(3, "l ", 1) .................................. = 1&lt;BR /&gt;[6591] time(NULL) ........................................ = 1152679758&lt;BR /&gt;[6592] read(3, "c ", 1) .................................. = 1&lt;BR /&gt;[6592] read(3, "o ", 1) .................................. = 1&lt;BR /&gt;[6592] read(3, "m ", 1) .................................. = 1&lt;BR /&gt;[6592] read(3, "\r", 1) .................................. = 1&lt;BR /&gt;[6591] sigtimedwait(0x7f7f0c88, NULL, 0x7f7f0ca8) ........ ERR#11 EAGAIN&lt;BR /&gt;[6591] time(NULL) ........................................ = 1152679760&lt;BR /&gt;[6591] sigprocmask(SIG_SETMASK, 0x7f7f0c58, NULL) ........ = 0&lt;BR /&gt;[6591] wait(0x7f7f0898) .................................. [sleeping]&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Jul 2006 23:58:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802995#M100377</guid>
      <dc:creator>Andreas Tsamis</dc:creator>
      <dc:date>2006-07-11T23:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802996#M100378</link>
      <description>It looks like /sbin/passwd is waiting for a newline.  Your program wrote "\n" but passwd read "\r".  That would happen if the pty had a termio setting of c_iflag|=INLCR that maps newline to carriage return.  It seems that the previous use of that pty pair left it set that way.  I would have expected termio to have default values, which "man 7 termio" says would not set the INLCR bit.  You could take control of this by using ioctl with TCSETA to set the termio values on the pty before the child process calls exec.</description>
      <pubDate>Thu, 13 Jul 2006 13:03:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802996#M100378</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2006-07-13T13:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help using pty</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802997#M100379</link>
      <description>The reason it writes \r is because i changed it in the code. With \n it didn't work so i tried \r but with no result</description>
      <pubDate>Thu, 13 Jul 2006 23:25:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-using-pty/m-p/3802997#M100379</guid>
      <dc:creator>Andreas Tsamis</dc:creator>
      <dc:date>2006-07-13T23:25:57Z</dc:date>
    </item>
  </channel>
</rss>

