Giter Club home page Giter Club logo

Comments (10)

clarkwang avatar clarkwang commented on June 27, 2024

According to AIX 7.2 ioctl manual, it requires one more include:

#include <stropts.h>

Could you help try if that can fix the issue?

from passh.

tjoepies avatar tjoepies commented on June 27, 2024

I added the line:

$ diff -u passh.c.original passh.c
--- passh.c.original    2020-03-20 05:37:40.000000000 +0200
+++ passh.c     2020-05-20 09:19:04.000000000 +0200
@@ -43,6 +43,7 @@
 #include <regex.h>
 #include <time.h>
 #include <fcntl.h>
+ #include <stropts.h>
 #include <sys/ioctl.h>
 #include <sys/select.h>
 #include <sys/types.h>

then when I run make, a new error line shows:

$ make
        gcc -O  passh.c -o passh
passh.c:360:18: warning: 'struct winsize' declared inside parameter list will not be visible outside of this definition or declaration
     const struct winsize *slave_winsize)
                  ^~~~~~~
In file included from /usr/include/stropts.h:30,
                 from passh.c:46:
passh.c: In function 'pty_fork':
passh.c:411:28: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
             if (ioctl(fds, TIOCSWINSZ, slave_winsize) < 0)
                            ^~~~~~~~~~
passh.c: In function 'big_loop':
passh.c:728:28: error: storage size of 'ttysize' isn't known
             struct winsize ttysize;
                            ^~~~~~~
In file included from /usr/include/stropts.h:30,
                 from passh.c:46:
passh.c:740:31: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
             if (ioctl(ourtty, TIOCGWINSZ, &ttysize) == 0) {
                               ^~~~~~~~~~
passh.c:741:34: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
                 ioctl(g.fd_ptym, TIOCSWINSZ, &ttysize);
                                  ^~~~~~~~~~
passh.c: In function 'main':
passh.c:929:20: error: storage size of 'size' isn't known
     struct winsize size;
                    ^~~~
In file included from /usr/include/stropts.h:30,
                 from passh.c:46:
passh.c:942:33: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
         if (ioctl(STDIN_FILENO, TIOCGWINSZ, (char *) &size) < 0)
                                 ^~~~~~~~~~
make: 1254-004 The error code from the last command is 1.


Stop.

would anything from ./configure that runs for sshpass assist us?

from passh.

clarkwang avatar clarkwang commented on June 27, 2024

Just checked sshpass code. It does not include stropts.h so that may be not an issue. The only .h which is in sshpass but not in passh is sys/stat.h though it does not seem to relate to struct winsize. Anyway, you can try:

  1. Include sys/stat.h and see if it helps;

  2. If it does not, try removing the following lines from passh.c:

    #if !defined(__APPLE__) && !defined(__FreeBSD__)
    #define _XOPEN_SOURCE 600 /* for posix_openpt() */
    #endif
    

from passh.

tjoepies avatar tjoepies commented on June 27, 2024

This worked for me, I restored the original passh.c and commented the lines out:

  1. If it does not, try removing the following lines from passh.c:
    #if !defined(__APPLE__) && !defined(__FreeBSD__)
    #define _XOPEN_SOURCE 600 /* for posix_openpt() */
    #endif
    

There is a small problem with the Makefile on AIX:

$ make
        gcc -O  passh.c -o passh
        rm passh
Target ".PHONY" is up to date.

it seems to run clean too

So I ran: gcc passh.c -o passh

All is well. Thank you

from passh.

clarkwang avatar clarkwang commented on June 27, 2024

Just committed a fix (one line change). Could you help verify?

from passh.

clarkwang avatar clarkwang commented on June 27, 2024

Oh. Did not notice your last update. My commit only fixed the gcc error. Will see how I can deal with the makefile.

from passh.

clarkwang avatar clarkwang commented on June 27, 2024

Makefile also updated. Please try (make clean; make).

from passh.

tjoepies avatar tjoepies commented on June 27, 2024
$ make clean; make
        rm passh
rm: passh: A file or directory in the path name does not exist.
make: 1254-004 The error code from the last command is 2.


Stop.
        cc -O  passh.c -o passh
cc: not found

make: 1254-004 The error code from the last command is 1.


Stop.

I added the following:

$ echo "CC = gcc" >> Makefile

then ran:

$ make
        gcc -O  passh.c -o passh
Target "all" is up to date.

and the passh file exists. Thank you

$ ./passh -h
Usage: passh [OPTION]... COMMAND...

  -c <N>          Send at most <N> passwords (0 means infinite. Default: 0)
  -C              Exit if prompted for the <N+1>th password
  -h              Help
  -i              Case insensitive for password prompt matching
  -n              Nohup the child (e.g. used for `ssh -f')
  -p <password>   The password (Default: `password')
  -p env:<var>    Read password from env var
  -p file:<file>  Read password from file
  -P <prompt>     Regexp (BRE) for the password prompt
                  (Default: `[Pp]assword: \{0,1\}$')
  -l <file>       Save data written to the pty
  -L <file>       Save data read from the pty
  -t <timeout>    Timeout waiting for next password prompt
                  (0 means no timeout. Default: 0)
  -T              Exit if timed out waiting for password prompt
  -y              Auto answer `(yes/no)?' questions

Report bugs to Clark Wang <[email protected]>

from passh.

clarkwang avatar clarkwang commented on June 27, 2024

Thanks for helping verify. For the cc part you can CC=gcc make.

from passh.

tjoepies avatar tjoepies commented on June 27, 2024

Thanks for helping verify. For the cc part you can CC=gcc make.

yes that did the trick.

$ CC=gcc make
        gcc -O  passh.c -o passh
Target "all" is up to date.

Thank you. I think this issue is closed now.

from passh.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.