Permalink
Browse files

Fixed double free bug

  • Loading branch information...
1 parent 2e9a8dd commit ab8f62008d99715b0bba61e1fff6fe48a47a5c4c @ditesh committed Jun 14, 2011
Showing with 8 additions and 4 deletions.
  1. +3 −3 demo/demo.js
  2. +5 −1 pam.cc
View
@@ -8,11 +8,11 @@ var pam = new pamlib.PAM();
// Change accordingly or write your own.
var service = "system-auth";
var username = "myusername";
-var password = "mypassword";
-pam.authenticate(service, username, password, function(result) {
+var password = "myuserpass";
+pam.authenticate(service, username, password, function(result) {
console.log("Username: " + username + ", password: " + password + ", result: " + result);
-
});
+
console.log("This will get printed first");
View
6 pam.cc
@@ -124,7 +124,11 @@ private: int m_count;
bool result = false;
struct baton_t* args = (struct baton_t *) req->data;
- int retval = _pam_authenticate(args->service, args->username, args->password);
+
+ char *service = strdup(args->service);
+ char *username = strdup(args->username);
+ char *password = strdup(args->password);
+ int retval = _pam_authenticate(service, username, password);
if (retval == PAM_SUCCESS)
result = true;

0 comments on commit ab8f620

Please sign in to comment.