NAME

Plugtools::Plugins::Samba - Provides various methods used by the plugins in this.

VERSION

Version 0.1.1

SYNOPSIS

This module provides a collection of methods used by the Samba plugins for Plugtools.

use Plugtools::Plugins::Samba;
use Plugtools;

my $pt=Plugtools->new;

my $ldap=$pt->connect;

my $pts = Plugtools::Plugins::Samba->new({
                                          pt=>$pt,
                                          ldap=>$ldap
                                         });
...

METHODS

new

This initiates it.

args hash

pt

This is a Plugtools object that has been successfully initiated.

ldap

This is the LDAP connection to use.

my $pts = Plugtools::Plugins::Samba->new({
                                          pt=>$pt,
                                          ldap=>$ldap
                                         });
if($pts->{error}){
    print "Error!\n";
}

isSambaAccountEntry

This check if all the basic stuff is present for it to be useful in regards to Samba. This checks to make sure the objectclass 'sambaSamAccount' and the attributes 'sambaSID' and 'sambaPrimaryGroupSID' are present.

args hash

entry

This is the LDAP entry that will be used.

my $returned=$pts->isSambaAccountEntry({entry=>$entry});
if($pts->{error}){
    print "Error!\n";
}else{
    if($returned){
        print "It is!\n";
    }
}

makeSambaAccountEntry

If a entry is not already a Samba account, make it one.

If it already is, it will error.

This will not update the entry that is passed to it. That will need to be done upon this returning with out any errors being set.

args hash

entry

This is the Net::LDAP::Entry object to work on.

sid

This is the SID to use for the entry.

pgsid

This is the primary group SID to use.

$pts->makeSambaAccountEntry({ entry=>$entry });
if($pts->{error}){
    print "Error!\n";
}

$pts->makeSambaAccountEntry({
                             entry=>$entry,
                             sid=>$sid,
                             pgsid=>$pgsid,
                            });
if($pts->{error}){
    print "Error!\n";
}

removeSambaAcctEntry

Remove the samba stuff from a user.

entry

This is a Net::LDAP::Entry to remove attributes related to sambaSamAccount from.

setPassEntry

This sets the password for a Samba account.

args hash

entry

This is the Net::LDAP::Entry object to work on.

pass

This is the password to set.

$pts->setPassEntry({
                   entry=>$entry,
                   pass=>'somepass',
                   });
if($pts->{error}){
    print "Error!\n";
}

sidUpdateEntry

args hash

entry

This is the Net::LDAP::Entry object to work on.

errorblank

This is a internal function and should not be called.

ERROR CODES

1

No Plugtools object given.

2

No LDAP connection specified.

3

No entry given.

4

No value for 'sid' defined in the section 'samba' of the config file.

5

Samba::SIDhelper errored.

6

The LDAP entry lacks a uidNumber attribute.

7

Already a samba a account.

8

The LDAP entry lacks a gidNumber attribute.

9

No password specified.

10

The LDAP entry is not a samba account.

11

The entry lacks a uidNumber attribute.

12

The entry lacks a uidNumber attribute.

Plugtools CONFIG

Only one additional setting is needed. That is 'sid' setup in the secion 'samba'.

The SID can be gotten by running 'net getlocalsid'.

pluginUserSetPass=Plugtools::Plugins::Samba::setPass
pluginUserGIDchange=Plugtools::Plugins::Samba::SIDupdate
pluginUserUIDchange=Plugtools::Plugins::Samba::SIDupdate
pluginAddUser=Plugtools::Plugins::Samba::makeSambaAccount
[samba]
sid=S-1-5-21-1234-5678-91011

AUTHOR

Zane C. Bowers, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-plugtools-plugins-samba at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Plugtools-Plugins-Samba. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Plugtools::Plugins::Samba

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 Zane C. Bowers, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.