Raymond Toy pushed to branch issue-393-os-common-getpwuid at cmucl / cmucl
Commits:
-
99b585ab
by Raymond Toy at 2025-03-28T12:26:46-07:00
2 changed files:
Changes:
... | ... | @@ -2417,9 +2417,12 @@ |
2417 | 2417 | ;;
|
2418 | 2418 | ;; While each OS may contain additional fields, we only need the ones
|
2419 | 2419 | ;; that are used the user-info structure.
|
2420 | +;;
|
|
2421 | +;; NOTE: This may NOT be the actual OS-defined passwd structure. It
|
|
2422 | +;; is the structure returned by os_getpwuid (in unix-getpwuid).
|
|
2420 | 2423 | |
2421 | 2424 | (def-alien-type nil
|
2422 | - (struct passwd
|
|
2425 | + (struct unix-passwd
|
|
2423 | 2426 | (pw-name (* char)) ; user's login name
|
2424 | 2427 | (pw-passwd (* char)) ; no longer used
|
2425 | 2428 | (pw-uid uid-t) ; user id
|
... | ... | @@ -946,7 +946,22 @@ os_get_user_homedir(const char* name, int *status) |
946 | 946 | * The caller MUST call os_free_getpwuid() to free the space allocated
|
947 | 947 | * by os_getpwuid().
|
948 | 948 | */
|
949 | -struct passwd*
|
|
949 | + |
|
950 | +/*
|
|
951 | + * This MUST match the definition in code/unix.lisp.
|
|
952 | + */
|
|
953 | +struct unix_passwd
|
|
954 | +{
|
|
955 | + char* pw_name;
|
|
956 | + char* pw_passwd;
|
|
957 | + uid_t pw_uid;
|
|
958 | + gid_t pw_gid;
|
|
959 | + char* pw_gecos;
|
|
960 | + char* pw_dir;
|
|
961 | + char* pw_shell;
|
|
962 | +};
|
|
963 | +
|
|
964 | +struct unix_passwd*
|
|
950 | 965 | os_getpwuid(uid_t uid)
|
951 | 966 | {
|
952 | 967 | char initial[1024];
|
... | ... | @@ -954,7 +969,7 @@ os_getpwuid(uid_t uid) |
954 | 969 | size_t size;
|
955 | 970 | struct passwd pwd;
|
956 | 971 | struct passwd *ppwd;
|
957 | - struct passwd *result = NULL;
|
|
972 | + struct unix_passwd *result = NULL;
|
|
958 | 973 | |
959 | 974 | buffer = initial;
|
960 | 975 | obuffer = NULL;
|
... | ... | @@ -973,7 +988,7 @@ again: |
973 | 988 | * that.
|
974 | 989 | */
|
975 | 990 | if (ppwd != NULL) {
|
976 | - result = (struct passwd*) malloc(sizeof(pwd));
|
|
991 | + result = (struct unix_passwd*) malloc(sizeof(pwd));
|
|
977 | 992 | result->pw_name = strdup(pwd.pw_name);
|
978 | 993 | result->pw_passwd = strdup(pwd.pw_passwd);
|
979 | 994 | result->pw_uid = pwd.pw_uid;
|