• Lubomir I. Ivanov (VMware)'s avatar
    os/user: obtain a user GID on Windows · 2a16176a
    Lubomir I. Ivanov (VMware) authored
    Add the following helpers in lookup_windows.go:
    1) lookupGroupName() is used to obtain the SID of a group based
    on name.
    2) listGroupsForUsernameAndDomain() uses NetUserGetLocalGroups()
    as a WINAPI backend to obtain the list of local groups for this
    user.
    3) lookupUserPrimaryGroup() is now used to populate the User.Gid
    field when looking up a user by name.
    
    Implement listGroups(), lookupGroupId(), lookupGroup() and no longer
    return unimplemented errors.
    
    Do not skip Windows User.Gid tests in user_test.go.
    
    Change-Id: I81fd41b406da51f9a4cb24e50d392a333df81141
    GitHub-Last-Rev: d1448fd55d6eaa0f41bf347df18b40da06791df1
    GitHub-Pull-Request: golang/go#24222
    Reviewed-on: https://go-review.googlesource.com/98137Reviewed-by: 's avatarAlex Brainman <alex.brainman@gmail.com>
    Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    2a16176a
lookup_windows.go 11.7 KB