user/gshadow.go
func (*GShadow) lookUp(line string, f field, value interface{}) interface{} {
	_field := f.(gshadowField)
	_value := value.(string)
	allField := strings.Split(line, ":")
	arrayField := make(map[int][]string)

	arrayField[2] = strings.Split(allField[2], ",")
	arrayField[3] = strings.Split(allField[3], ",")

	// Check fields
	var isField bool
	if GS_NAME&_field != 0 && allField[0] == _value {
		isField = true
	} else if GS_PASSWD&_field != 0 && allField[1] == _value {
		isField = true
	} else if GS_ADMIN&_field != 0 && checkGroup(arrayField[2], _value) {
		isField = true
	} else if GS_MEMBER&_field != 0 && checkGroup(arrayField[3], _value) {
		isField = true
	} else if GS_ALL&_field != 0 {
		isField = true
	}

	if isField {
		return &GShadow{
			allField[0],
			allField[1],
			arrayField[2],
			arrayField[3],
		}
	}
	return nil
}
func (*GShadow) lookUp(line string, f field, value interface{}) interface{} {
	_field := f.(gshadowField)
	_value := value.(string)
	allField := strings.Split(line, ":")
	arrayField := make(map[int][]string)

	arrayField[2] = strings.Split(allField[2], ",")
	arrayField[3] = strings.Split(allField[3], ",")

	// Check fields
	var isField bool
	if GS_NAME&_field != 0 && allField[0] == _value {
		isField = true
	} else if GS_PASSWD&_field != 0 && allField[1] == _value {
		isField = true
	} else if GS_ADMIN&_field != 0 && checkGroup(arrayField[2], _value) {
		isField = true
	} else if GS_MEMBER&_field != 0 && checkGroup(arrayField[3], _value) {
		isField = true
	} else if GS_ALL&_field != 0 {
		isField = true
	}

	if isField {
		return &GShadow{
			allField[0],
			allField[1],
			arrayField[2],
			arrayField[3],
		}
	}
	return nil
}
func ( * GShadow ) lookUp ( line string , f field , value interface { } ) interface { } { _field := f . ( gshadowField ) _value := value . ( string ) allField := strings . Split ( line , " " ) arrayField := make ( map [ int ] [ ] string ) arrayField [ 2 ] = strings . Split ( allField [ 2 ] , " " ) arrayField [ 3 ] = strings . Split ( allField [ 3 ] , " " ) // Check fields var isField bool if GS_NAME & _field != 0 && allField [ 0 ] == _value { isField = true } else if GS_PASSWD & _field != 0 && allField [ 1 ] == _value { isField = true } else if GS_ADMIN & _field != 0 && checkGroup ( arrayField [ 2 ] , _value ) { isField = true } else if GS_MEMBER & _field != 0 && checkGroup ( arrayField [ 3 ] , _value ) { isField = true } else if GS_ALL & _field != 0 { isField = true } if isField { return & GShadow { allField [ 0 ] , allField [ 1 ] , arrayField [ 2 ] , arrayField [ 3 ] , } } return nil }
// == Lookup
//
// lookUp parses the shadowed group line searching a value into the field.
// Returns nil if it isn't found.
== Lookup lookUp parses the shadowed group line searching a value into the field . Returns nil if it isn t found .