Professional Web Applications Themes

HPUX password change problem - Linux / Unix Administration

Hi all, I wrote an application in HP UX to change the password like passwd command. When I try to change the password of a user, it asks for Old password. Note that I am running my application as root. But in the same michine the "passwd" command works fine. Is there is any configuration file exist where I can put my application name to work perfectly? Any one have any Idea about this? Note: The same program works perfectly in all other machines including AIX Linux etc. Thanks...

  1. #1

    Default HPUX password change problem

    Hi all,

    I wrote an application in HP UX to change the password like passwd
    command. When I try to change the password of a user, it asks for Old
    password. Note that I am running my application as root. But in the
    same michine the "passwd" command works fine.

    Is there is any configuration file exist where I can put my
    application name to work perfectly? Any one have any Idea about this?

    Note: The same program works perfectly in all other machines including
    AIX Linux etc.

    Thanks

    Shijith Guest

  2. #2

    Default Re: HPUX password change problem

    On 20 Oct 2005 21:43:59 -0700, Shijith
    <com> wrote: 
    If you wrote the application, how can anyone else know what is wrong
    without seeing the source code? How does your application test whether
    it is running as root before it asks for the old password?


    --
    Eggheads unite! You have nothing to lose but your yolks.
    -- Adlai Stevenson
    Bill Guest

  3. #3

    Default Re: HPUX password change problem

    I am using PAM to change the password. Actulayy PAM module is
    responsible for changing password. I am attaching the source code here

    #include <security/pam_appl.h>
    #include <stdio.h>
    #include <pwd.h>
    #include <stdlib.h>
    #include <string.h>
    /*
    * PAM call back function to read the password values
    */

    extern int convert(int num_msg,struct pam_message **msg,struct
    pam_response **resp,void *appdata_ptr)
    {
    // Initialize PAM response object and set password
    struct pam_response *temp;
    temp = (struct pam_response *)calloc(num_msg,sizeof(struct
    pam_response));
    temp[0].resp_retcode = 0;
    temp[0].resp = strdup((const char*)appdata_ptr);
    *resp = temp;
    return PAM_SUCCESS;
    }

    static struct pam_conv conv = {convert,NULL};
    /*
    * Function used to change the password of a user
    */
    int changePasswd(char *user,char *pass)
    {
    pam_handle_t *pamh=NULL;
    int retval;
    struct pam_response *pp=NULL;
    conv.appdata_ptr = pass;
    // initialize PAM
    retval = pam_start("myapp", user, &conv, &pamh);
    if (retval == PAM_SUCCESS)
    {
    // Change password (auth tocken)
    retval = pam_chauthtok(pamh, PAM_SILENT);
    }
    if (retval != PAM_SUCCESS)
    {
    return -1;
    }
    // End PAM Session
    if (pam_end(pamh,retval) != PAM_SUCCESS)
    {
    pamh = NULL;
    return -1;
    }
    return 0;
    }

    int main()
    {
    int res = changePasswd("user","mypass");
    printf( "Res = %d", res);
    return 0;

    }

    I entered a correct entry in pam.conf file also

    Shijith Guest

Similar Threads

  1. How do you change the password?
    By stutz7 in forum Coldfusion Server Administration
    Replies: 1
    Last Post: November 9th, 10:53 AM
  2. Mysql-DBD Perl module Installation Problem in HPUX
    By smsabu2002@yahoo.com in forum PERL Modules
    Replies: 1
    Last Post: June 30th, 05:59 PM
  3. ER problem HPUX - Linux
    By Sjaak van Esdonk in forum Informix
    Replies: 2
    Last Post: November 17th, 06:49 AM
  4. DBD::Oracle installation problem at HPUX
    By porschberg in forum PERL Modules
    Replies: 0
    Last Post: November 5th, 02:31 PM
  5. [PHP-DEV] PHP thread stack problem on HPUX
    By NAIK,ROSHAN in forum PHP Development
    Replies: 4
    Last Post: July 19th, 01:52 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139