user/crypt.go
func lookupCrypter() (crypt.Crypter, error) {
	f, err := os.Open(_SHADOW_FILE)
	if err != nil {
		return nil, err
	}
	defer f.Close()

	buf := bufio.NewReader(f)

	for {
		line, _, err := buf.ReadLine()
		if err != nil {
			if err == io.EOF {
				return nil, ErrShadowPasswd
			}
			log.Print(err)
			continue
		}

		shadow, err := parseShadow(string(line))
		if err != nil {
			log.Print(err)
			continue
		}
		if shadow.password[0] == '$' {
			return crypt.NewFromHash(shadow.password), nil
		}
	}
	return nil, ErrShadowPasswd
}
func lookupCrypter() (crypt.Crypter, error) {
	f, err := os.Open(_SHADOW_FILE)
	if err != nil {
		return nil, err
	}
	defer f.Close()

	buf := bufio.NewReader(f)

	for {
		line, _, err := buf.ReadLine()
		if err != nil {
			if err == io.EOF {
				return nil, ErrShadowPasswd
			}
			log.Print(err)
			continue
		}

		shadow, err := parseShadow(string(line))
		if err != nil {
			log.Print(err)
			continue
		}
		if shadow.password[0] == '$' {
			return crypt.NewFromHash(shadow.password), nil
		}
	}
	return nil, ErrShadowPasswd
}
func lookupCrypter ( ) ( crypt . Crypter , error ) { f , err := os . Open ( _SHADOW_FILE ) if err != nil { return nil , err } defer f . Close ( ) buf := bufio . NewReader ( f ) for { line , _ , err := buf . ReadLine ( ) if err != nil { if err == io . EOF { return nil , ErrShadowPasswd } log . Print ( err ) continue } shadow , err := parseShadow ( string ( line ) ) if err != nil { log . Print ( err ) continue } if shadow . password [ 0 ] == '$' { return crypt . NewFromHash ( shadow . password ) , nil } } return nil , ErrShadowPasswd }
// lookupCrypter returns the first crypt function found in shadowed passwd file.
lookupCrypter returns the first crypt function found in shadowed passwd file .