Closed

custom NSS plugin written in C to call perl script for passwd listing

The ideal freelancer for this job has a deep understanding of Linux, shared libraries, C programming, Name Service Switch. It shouldn't take someone who knows what they are doing a couple of hours to complete. Must be developed on or for 64bit Debian Wheezy 7.0. Delivered files to include "Makefile, README, nss-custom.c" and any custom header files. Please ask questions if you are interested. The scope of this plugin may increase in the future.

I need a NSS plugin like libnss-mysql-ng, libnss-extrausers, etc. When NSS is called, it must be able to run a perl script to return passwd style entries. Only 3 NSS calls need to be available: getpwnam, getpwuid, getpwent. Assume the perl script to be called is /usr/local/sbin/nssCustom.pl.

A config script to be read by the C program /etc/[url removed, login to view] has 2 configuration variables and looks like this:

# config script for libnss-nsscustom

environment: foobar

script: /usr/local/sbin/[url removed, login to view]

Also /etc/[url removed, login to view] looks like this for passwd:

passwd: compat nsscustom

Within the C program the [url removed, login to view] script is called with the first argument being whatever is set as environment in /etc/[url removed, login to view] (i.e. foobar). The second arguement to the perl script is the type of NSS call (one of getpwent, getpwnam, or getpwuid). The third argument to the perl script should be the username OR uid for getpwnam and getpwuid respectively. (There will be no 3rd arguement for getpwent and the perl script will return the whole list)

using getent to test should look like this:

getent passwd (C program calls /usr/local/sbin/[url removed, login to view] foobar getpwent)

-> should get all system users (because compat is first in [url removed, login to view]) and return all user pw entries from the perl scipt

getent passwd jdoe (C program calls /usr/local/sbin/[url removed, login to view] foobar getpwnam jdoe)

-> should get all system users (because compat is first in [url removed, login to view]) and return the pw entry for username jdoe

getent passwd 1001 (C program calls /usr/local/sbin/[url removed, login to view] foobar getpwnam 1001)

-> should get all system users (because compat is first in [url removed, login to view]) and return the pw entry for uid 1001

simple hacked script to use for testing /usr/local/sbin/[url removed, login to view]:

#!/usr/bin/perl

use strict;

if ( $#ARGV < 1 ){

exit;

}

my $users='bingobill:x:30014:666:Bingo Bill:/home/:/bin/bash

yepyepyep:x:30015:666:yep yepyep:/home/:/bin/bash

aasdf:x:30016:666:asdf asdf:/home/:/bin/bash

tloki:x:30018:666:thor loki:/home/:/bin/bash

';

if ( "$ARGV[0]" eq "foobar" ) {

if ( "$ARGV[1]" eq "getpwent" ) {

print "$users";

} elsif ( $ARGV[1] eq "getpwnam" ) {

my @lines = split /\n/, $users;

foreach my $line (@lines) {

my @fields = split ":", $line;

if ( "$fields[0]" eq "$ARGV[2]" ){

print $line, "\n";

}

}

} elsif ( $ARGV[1] eq "getpwuid" ) {

my @lines = split /\n/, $users;

foreach my $line (@lines) {

my @fields = split ":", $line;

if ( "$fields[2]" eq "$ARGV[2]" ){

print $line, "\n";

}

}

}else{

# do nothing for now

}

}

typo:

getent passwd 1001 (C program calls /usr/local/sbin/nssCustom.pl foobar getpwuid 1001)

also budget should bet 20-200... can't find where to edit that.

Skills: C Programming, Perl

See more: when to use freelancer, what is in c programming, what is c# programming, what is c programming, variables in programming, user testing freelancer, type of freelancer username, system x on freelancer, switch c programming, set in c, scope programming, pw freelancer, programming test questions, programming job freelancer, programming in perl, programming freelancer c++, perl get, or in c programming, one line programming job, linux programming freelancer, job freelancer programming, it freelancer pl, i need a job from home now, in c programming, & in c programming

About the Employer:
( 0 reviews ) United States

Project ID: #4919631

2 freelancers are bidding on average $197 for this job

lepoitr

I'm interested. I'm experienced(15+) perl developer and linux administrator.

$368 USD in 3 days
(14 Reviews)
5.4
gevorgsargsyan

I have over 5 years experience in Linux programming C/C++ and I am also good in perl. Will look forward to be hired by you

$277 USD in 3 days
(0 Reviews)
0.0
sandyr39

i will try to complete it but not sure

$25 USD in 3 days
(0 Reviews)
0.0