Permalink
Browse files

0.1.3 release

  • Loading branch information...
ditesh committed Nov 8, 2011
1 parent 333dc96 commit 7cdd77156a299f74e7b49b16c9007142c62a362c
Showing with 39 additions and 73 deletions.
  1. +4 −0 CHANGELOG
  2. +0 −31 demo/demo.js
  3. +2 −2 demo/flock.js
  4. +1 −1 demo/mkstemp.js
  5. +1 −1 demo/pam.js
  6. +3 −3 package.json
  7. +28 −35 unixlib.cc
View
@@ -1,3 +1,7 @@
+0.1.3 (Tue Nov 8 14:50:59 MYT 2011):
+ * Node.js v0.6 support, fixes issue #3
+ * Updated demos, fixed miscellaneos typos
+
0.1.2 (Mon Oct 31 11:08:12 MYT 2011):
* Added PAM header file dependency
* Added CHANGELOG
View
@@ -1,31 +0,0 @@
-var fs = require("fs");
-var unixlib = require("unix");
-var filename = "/tmp/somefile";
-
-fs.open(filename, "r", function(err, fd) {
-
- // This should work
- unixlib.flock(fd, function(result) {
-
- if (result) {
-
- console.log("File has been successfully flocked");
-
- // This should not work
- unixlib.flock(fd, function(result) {
-
- if (result)
- console.log("File has been successfully flocked, against our most sincere expectations");
- else
- console.log("File cannot be flocked, as we expected");
-
- });
-
- } else {
-
-
- console.log("For some reason, couldn't flock");
-
- }
- });
-});
View
@@ -1,5 +1,5 @@
var fs = require("fs");
-var unixlib = require("../build/default/unixlib");
+var unixlib = require("../build/Release/unixlib");
var filename = "/tmp/flock.example";
// Let's try flocking
@@ -10,5 +10,5 @@ fs.open(filename, "r", undefined, function(err, fd) {
unixlib.flock(fd, function(result) {
console.log(result);
});
- }
+ } else console.log(err);
});
View
@@ -1,4 +1,4 @@
-var unixlib = require("../build/default/unixlib");
+var unixlib = require("../build/Release/unixlib");
var goodstrtemplate = "/tmp/mkstempXXXXXX";
var badstrtemplate = "/tmp/mkstempXXX";
View
@@ -1,4 +1,4 @@
-var unixlib = require("../build/default/unixlib");
+var unixlib = require("../build/Release/unixlib");
// Change accordingly or write your own.
var service = "system-auth";
View
@@ -1,8 +1,8 @@
{
"name" : "unixlib",
- "version" : "v0.1.2",
+ "version" : "v0.1.3",
"description" : "Native Linux utilities for Node.js, currently PAM authentication, flock() and mkstemp",
- "homepage" : "https://github.com/ditesh/node-unix",
+ "homepage" : "https://github.com/ditesh/node-unixlib",
"keywords": ["linux", "flock", "pam", "authentication", "unix"],
"author" : {
"name" : "Ditesh Shashikant Gathani",
@@ -14,5 +14,5 @@
"preinstall" : "node-waf configure && node-waf build",
"preuninstall" : "rm -r build/*"
},
- "main" : "build/default/unixlib.node"
+ "main" : "build/Release/unixlib.node"
}
View
@@ -21,48 +21,48 @@ static void Mkstemp(eio_req *);
static int AfterMkstemp(eio_req *);
static Handle<Value> FlockAsync(const Arguments&);
static void Flock(eio_req *);
-static int AfterFlock(eio_req *);
+static int AfterFlock(eio_req *);
static Handle<Value> PAMAuthAsync(const Arguments&);
static void PAMAuth(eio_req *);
static int AfterPAMAuth(eio_req *);
extern "C" void init(Handle<Object>);
extern "C" {
- struct pam_response *reply;
-
- int null_conv(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) {
+ struct pam_response *reply;
- *resp = reply;
- return PAM_SUCCESS;
-
- }
-
- static struct pam_conv conv = { null_conv, NULL };
-
- const char* ToCString(const v8::String::Utf8Value& value) {
- return *value ? *value : "<string conversion failed>";
- }
+ int null_conv(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) {
- int _pam_authenticate(const char *service, const char *username, const char *password) {
+ *resp = reply;
+ return PAM_SUCCESS;
- pam_handle_t *pamh = NULL;
- int retval = pam_start(service, username, &conv, &pamh);
+ }
- if (retval == PAM_SUCCESS) {
+ static struct pam_conv conv = { null_conv, NULL };
- reply = (struct pam_response *) malloc(sizeof(struct pam_response));
- reply[0].resp = (char *) password;
- reply[0].resp_retcode = 0;
+ const char* ToCString(const v8::String::Utf8Value& value) {
+ return *value ? *value : "<string conversion failed>";
+ }
- retval = pam_authenticate(pamh, 0);
- pam_end(pamh, PAM_SUCCESS);
+ int _pam_authenticate(const char *service, const char *username, const char *password) {
- }
+ pam_handle_t *pamh = NULL;
+ int retval = pam_start(service, username, &conv, &pamh);
- return retval;
+ if (retval == PAM_SUCCESS) {
+
+ reply = (struct pam_response *) malloc(sizeof(struct pam_response));
+ reply[0].resp = (char *) password;
+ reply[0].resp_retcode = 0;
+
+ retval = pam_authenticate(pamh, 0);
+ pam_end(pamh, PAM_SUCCESS);
}
+
+ return retval;
+
+ }
}
struct mkstemp_baton {
@@ -179,9 +179,6 @@ static void Mkstemp(eio_req *req) {
baton->result = true;
}
-
- //return 0;
-
}
static void Flock(eio_req *req) {
@@ -193,8 +190,6 @@ static void Flock(eio_req *req) {
else
baton->result = true;
- //return 0;
-
}
static void PAMAuth(eio_req *req) {
@@ -208,8 +203,6 @@ static void PAMAuth(eio_req *req) {
if (retval == PAM_SUCCESS)
baton->result = true;
- //return 0;
-
}
static int AfterMkstemp(eio_req *req) {
@@ -241,7 +234,7 @@ static int AfterMkstemp(eio_req *req) {
baton->cb.Dispose();
delete baton;
- return 0;
+ return 0;
}
@@ -265,7 +258,7 @@ static int AfterFlock(eio_req *req) {
baton->cb.Dispose();
delete baton;
- return 0;
+ return 0;
}
@@ -291,7 +284,7 @@ static int AfterPAMAuth(eio_req *req) {
baton->cb.Dispose();
delete baton;
- return 0;
+ return 0;
}

0 comments on commit 7cdd771

Please sign in to comment.