-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f37aa1
commit 603d564
Showing
6 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <sys/types.h> | ||
#include <stddef.h> | ||
|
||
// Mock structure similar to 'struct passwd' in pwd.h | ||
struct passwd { | ||
char *pw_name; // user's name | ||
char *pw_passwd; // user's password | ||
uid_t pw_uid; // user's user ID | ||
gid_t pw_gid; // user's group ID | ||
char *pw_gecos; // user's real name | ||
char *pw_dir; // user's home directory | ||
char *pw_shell; // user's shell program | ||
}; | ||
|
||
// Mock function similar to 'getpwnam' in pwd.h | ||
struct passwd *getpwnam(const char *name) { | ||
static struct passwd mock_user; | ||
|
||
// Hardcoded user information | ||
mock_user.pw_name = "mockuser"; | ||
mock_user.pw_passwd = "mockpassword"; | ||
mock_user.pw_uid = 1000; | ||
mock_user.pw_gid = 1000; | ||
mock_user.pw_gecos = "Mock User"; | ||
mock_user.pw_dir = "/home/mockuser"; | ||
mock_user.pw_shell = "/bin/sh"; | ||
|
||
return &mock_user; | ||
} | ||
|
||
// ... other mock functions as needed ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef MOCK_PWD_H | ||
#define MOCK_PWD_H | ||
|
||
#include <sys/types.h> | ||
|
||
// Mock structure similar to 'struct passwd' in pwd.h | ||
struct passwd { | ||
char *pw_name; // user's name | ||
char *pw_passwd; // user's password | ||
uid_t pw_uid; // user's user ID | ||
gid_t pw_gid; // user's group ID | ||
char *pw_gecos; // user's real name | ||
char *pw_dir; // user's home directory | ||
char *pw_shell; // user's shell program | ||
}; | ||
|
||
// Mock function declaration | ||
struct passwd *getpwnam(const char *name); | ||
|
||
#endif // MOCK_PWD_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters