Results 1 to 12 of 12

Thread: I need help with C!

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member
    Join Date
    Sep 2008
    Posts
    810
    Credits
    848
    Mentioned
    0 Post(s)

    Default

    Quote Originally Posted by sudo View Post
    Okay, so in AIX, there are various subroutines that is built in to the OS. The subroutine is I want to use is passwdpolicy(). So I want to construct a C program that will be able to pass credentials into the program and thusly into the subroutine.

    Here is the subroutine:

    #include <pwdpolicy.h>
    int passwdpolicy (const char *name, int type, const char *old_password,
    const char *new_password, time64_t last_update);


    Now. Let's say I want to test the password for the user testy, with an old password of a1s2d3f4 and a new password of q1w2e3r4.

    Here is the link to the subroutine, via IBM: http://publib.boulder.ibm.com/infoce...sswdpolicy.htm

    I don't know much about C, so everytime I try to compile this, I get syntax errors because I have no idea how to define it, call it, etc.

    Anyone know C can help me?
    I'm not familiar with the function but based on the description it looks like if you just define an int like:

    int x = passwdpolicy ("testy", PWP_USERNAME, "oldpass", "newpass", 0);

    It'll return if it's a valid password based on that user's policy (0 is the ideal return value). But I mean I really have no idea I've never dealt with this in C

  2. #2
    Senior Member
    Join Date
    Sep 2008
    Posts
    85
    Credits
    344
    Mentioned
    0 Post(s)

    Default

    Quote Originally Posted by jared View Post
    I'm not familiar with the function but based on the description it looks like if you just define an int like:

    int x = passwdpolicy ("testy", PWP_USERNAME, "oldpass", "newpass", 0);

    It'll return if it's a valid password based on that user's policy (0 is the ideal return value). But I mean I really have no idea I've never dealt with this in C
    Do I need to echo the variable then?

    Like

    printf("The return value is", x);

    ??

    Quote Originally Posted by Supersonic View Post
    for what exactly are you trying to do this?
    I'm building a script to have non-users have limited sudo access to a script to change their passwords across 400+ servers. I'm writing a script that checks for password strength.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •