History

Updates to Unix based UserInfo implementation.

ritchiecarroll committed 12 years ago

Commit bf22ae21 parent 2ab4c339 files · +284 −43Browse files

Showing the changes to Source/Tools/UnixTools/GSF.POSIX.c (1 of 9 files). Show all

Unified · Split

Source/Tools/UnixTools/GSF.POSIX.c+15−18
@@ -21,14 +21,23 @@ · 20 unmodified lines
2121 //
2222 //******************************************************************************************************
2323
24+// This will create a shared object for needed GSF functions
25+
2426 // Compiling for Linux:
2527 //
26−// Get PAM development libraries, e.g., for Ubuntu: apt-get install libpam0g-dev
28+// Get PAM development libraries, e.g., for Ubuntu: apt-get install libpam0g-dev
2729 //
30+// To compile to an object library
2831 // gcc -c -Wall -Werror -fpic GSF.POSIX.c
29−// gcc -shared -o GSF.POSIX.so GSF.POSIX.o -lpam -lpam_misc
32+//
33+// To compile as a shared object
34+// gcc -shared -o GSF.POSIX.so GSF.POSIX.o -lpam -lpam_misc -lcrypt
35+//
36+// To deploy, copy to user libraries folder
37+// sudo cp GSF.POSIX.so /usr/lib/
3038 //
3139
40+#include <stdlib.h>
3241 #include <security/pam_appl.h>
3342 #include <security/pam_misc.h>
3443 #include <sys/types.h>
@@ -39,26 +48,14 @@ · 4 unmodified lines
3948 #include <grp.h>
4049 #include <shadow.h>
4150 #include <crypt.h>
42−
43−// Structure used to return key spwd information
44−struct UserPasswordInformation
45−{
46− // Do not include any pointer types in this structure
47− // to keep marshaling into .NET simple
48− long lastChangeDate;
49− long minDaysForChange;
50− long maxDaysForChange;
51− long warningDays;
52− long inactivityDays;
53− long accountExpirationDate;
54−};
51+#include "GSF.POSIX.h"
5552
5653 // Define custom PAM conversation function for authentication
5754 int AuthenticateConveration(int num_msg, const struct pam_message** msg, struct pam_response** resp, void* appdata_ptr)
5855 {
5956 const struct pam_message* message = *msg;
6057
61− if (num_msg == 1 && message->msg != NULL && message->msg_style == PAM_PROMPT_ECHO_ON)
58+ if (num_msg == 1 && message->msg != NULL && message->msg_style == PAM_PROMPT_ECHO_OFF)
6259 {
6360 // Provide password for the PAM conversation response that was passed into appdata_ptr
6461 struct pam_response* reply = (struct pam_response*)malloc(sizeof(struct pam_response));
@@ -139,8 +136,8 @@ int AuthenticateUser(const char* userName, const char* password) · 74 unmodified lines
139136 pam_handle_t* pamh;
140137 int retval;
141138
142− // Start PAM - just associate with something simple like the "whoami" command
143− retval = pam_start("whoami", userName, &pamc, &pamh);
139+ // Start PAM - just associate with something simple like the "passwd" command
140+ retval = pam_start("gsf", userName, &pamc, &pamh);
144141
145142 if (retval == PAM_SUCCESS)
146143 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t