openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/shadow/4.6-r0/shadow-4.6/src/newusers.c
static int update_passwd(struct passwd* pwd, const char* password)
{
    void* crypt_arg = NULL;
    char* cp;
    if (crypt_method != NULL)
    {
#ifdef USE_SHA_CRYPT
        if (sflg)
        {
            crypt_arg = &sha_rounds;
        }
#endif
    }

    if ((crypt_method != NULL) && (0 == strcmp(crypt_method, "NONE")))
    {
        pwd->pw_passwd = (char*)password;
    }
    else
    {
        const char* salt = crypt_make_salt(crypt_method, crypt_arg);
        cp = pw_encrypt(password, salt);
        if (NULL == cp)
        {
            fprintf(stderr,
                    _("%s: failed to crypt password with salt '%s': %s\n"),
                    Prog, salt, strerror(errno));
            return 1;
        }
        pwd->pw_passwd = cp;
    }

    return 0;
}
/*
 * update_passwd - update the password in the passwd entry
 *
 * Return 0 if successful.
 */
update the password in the passwd entry
Return 0 if successful.
update the password in the passwd entry Return 0 if successful .
static int update_passwd(struct passwd* pwd, const char* password)
{
    void* crypt_arg = NULL;
    char* cp;
    if (crypt_method != NULL)
    {
#ifdef USE_SHA_CRYPT
        if (sflg)
        {
            crypt_arg = &sha_rounds;
        }
#endif
    }
    if ((crypt_method != NULL) && (0 == strcmp(crypt_method, "NONE")))
    {
        pwd->pw_passwd = (char*)password;
    }
    else
    {
        const char* salt = crypt_make_salt(crypt_method, crypt_arg);
        cp = pw_encrypt(password, salt);
        if (NULL == cp)
        {
            fprintf(stderr,
                    _("%s: failed to crypt password with salt '%s': %s\n"),
                    Prog, salt, strerror(errno));
            return 1;
        }
        pwd->pw_passwd = cp;
    }
    return 0;
}
static int update_passwd ( struct passwd * pwd , const char * password ) { void * crypt_arg = NULL ; char * cp ; if ( crypt_method != NULL ) { #ifdef USE_SHA_CRYPT if ( sflg ) { crypt_arg = & sha_rounds ; } #endif } if ( ( crypt_method != NULL ) && ( 0 == strcmp ( crypt_method , " " ) ) ) { pwd -> pw_passwd = ( char * ) password ; } else { const char * salt = crypt_make_salt ( crypt_method , crypt_arg ) ; cp = pw_encrypt ( password , salt ) ; if ( NULL == cp ) { fprintf ( stderr , _ ( " \n " ) , Prog , salt , strerror ( errno ) ) ; return 1 ; } pwd -> pw_passwd = cp ; } return 0 ; }
update_passwd - update the password in the passwd entry
 Return 0 if successful.
update_passwd - update the password in the passwd entry Return 0 if successful .