Net-LDAP-SID-0.001/000755 000766 000024 00000000000 12735512701 014030 5ustar00karpetstaff000000 000000 Net-LDAP-SID-0.001/Changes000644 000766 000024 00000000160 12735264163 015326 0ustar00karpetstaff000000 000000 Revision history for Net-LDAP-SID 0.001 Date/time First version, released on an unsuspecting world. Net-LDAP-SID-0.001/MANIFEST000644 000766 000024 00000000463 12735512701 015164 0ustar00karpetstaff000000 000000 Changes lib/Net/LDAP/SID.pm Makefile.PL MANIFEST This list of files README t/00-load.t t/01-sids.t t/manifest.t t/pod-coverage.t t/pod.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Net-LDAP-SID-0.001/META.json000644 000766 000024 00000002325 12735512701 015453 0ustar00karpetstaff000000 000000 { "abstract" : "Active Directory Security Identifier manipulation", "author" : [ "Peter Karman " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.1, CPAN::Meta::Converter version 2.140640", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Net-LDAP-SID", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "Test::More" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "perl" : "5.008003" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-LDAP-SID" }, "homepage" : "https://github.com/karpet/net-ldap-sid", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "https://github.com/karpet/net-ldap-sid" } }, "version" : "0.001" } Net-LDAP-SID-0.001/META.yml000644 000766 000024 00000001335 12735512701 015303 0ustar00karpetstaff000000 000000 --- abstract: 'Active Directory Security Identifier manipulation' author: - 'Peter Karman ' build_requires: Test::More: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.1, CPAN::Meta::Converter version 2.140640' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Net-LDAP-SID no_index: directory: - t - inc requires: perl: '5.008003' resources: bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-LDAP-SID homepage: https://github.com/karpet/net-ldap-sid license: http://dev.perl.org/licenses/ repository: https://github.com/karpet/net-ldap-sid version: '0.001' Net-LDAP-SID-0.001/Makefile.PL000644 000766 000024 00000002735 12735264260 016015 0ustar00karpetstaff000000 000000 use 5.006; use strict; use warnings; use ExtUtils::MakeMaker; my $MM_Version = $ExtUtils::MakeMaker::VERSION; if ( $MM_Version =~ /_/ ) # dev version { $MM_Version = eval $MM_Version; die $@ if ($@); } WriteMakefile( NAME => 'Net::LDAP::SID', AUTHOR => q{Peter Karman }, VERSION_FROM => 'lib/Net/LDAP/SID.pm', ABSTRACT_FROM => 'lib/Net/LDAP/SID.pm', LICENSE => 'artistic_2', PL_FILES => {}, MIN_PERL_VERSION => 5.006, CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => 0, }, BUILD_REQUIRES => { 'Test::More' => 0, }, PREREQ_PM => { #'ABC' => 1.6, #'Foo::Bar::Module' => 5.0401, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Net-LDAP-SID-*' }, ( $MM_Version >= 6.48 ? ( MIN_PERL_VERSION => '5.8.3' ) : () ), ( $MM_Version >= 6.31 ? ( LICENSE => 'perl' ) : () ), ( $MM_Version <= 6.44 ? () : ( META_MERGE => { resources => { license => 'http://dev.perl.org/licenses/', homepage => 'https://github.com/karpet/net-ldap-sid', bugtracker => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-LDAP-SID', repository => 'https://github.com/karpet/net-ldap-sid' }, } ) ), ); Net-LDAP-SID-0.001/README000644 000766 000024 00000005271 12735264365 014727 0ustar00karpetstaff000000 000000 Net-LDAP-SID Active Directory Security Identifier manipulation. See https://en.wikipedia.org/wiki/Security_Identifier INSTALLATION To install this module, run the following commands: perl Makefile.PL make make test make install SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc Net::LDAP::SID You can also look for information at: RT, CPAN's request tracker (report bugs here) http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-LDAP-SID AnnoCPAN, Annotated CPAN documentation http://annocpan.org/dist/Net-LDAP-SID CPAN Ratings http://cpanratings.perl.org/d/Net-LDAP-SID Search CPAN http://search.cpan.org/dist/Net-LDAP-SID/ LICENSE AND COPYRIGHT Copyright (C) 2016 Peter Karman This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: L Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Net-LDAP-SID-0.001/lib/000755 000766 000024 00000000000 12735512701 014576 5ustar00karpetstaff000000 000000 Net-LDAP-SID-0.001/t/000755 000766 000024 00000000000 12735512701 014273 5ustar00karpetstaff000000 000000 Net-LDAP-SID-0.001/t/00-load.t000644 000766 000024 00000000335 12735264067 015626 0ustar00karpetstaff000000 000000 #!perl -T use 5.006; use strict; use warnings; use Test::More; plan tests => 1; BEGIN { use_ok( 'Net::LDAP::SID' ) || print "Bail out!\n"; } diag( "Testing Net::LDAP::SID $Net::LDAP::SID::VERSION, Perl $], $^X" ); Net-LDAP-SID-0.001/t/01-sids.t000644 000766 000024 00000002511 12735511555 015645 0ustar00karpetstaff000000 000000 #!/usr/bin/env perl use strict; use warnings; use Test::More tests => 18; use Net::LDAP::SID; my %sids = ( 'S-1-285952273-653124832-513' => '01/02/00/00/11/0b/49/11/e0/e4/ed/26/01/02/00/00', 'S-1-5-21-2127521184-1604012920-1887927527-72713' => '01/05/00/00/00/00/00/05/15/00/00/00/A0/65/CF/7E/78/4B/9B/5F/E7/7C/87/70/09/1C/01/00', 'S-1-2-3-4-5-6-1234' => '01/05/00/00/00/00/00/02/03/00/00/00/04/00/00/00/05/00/00/00/06/00/00/00/d2/04/00/00' ); for my $sid_string ( keys %sids ) { compare_string_and_binary( $sid_string, $sids{$sid_string} ); } sub compare_string_and_binary { my ( $sid_string, $sid_hex_string ) = @_; my $sid_binary = pack '(H2)*', split( /\//, $sid_hex_string ); diag("str = $sid_string"); diag( "bin = " . join( '\\', unpack '(H2)*', $sid_binary ) ); eval { ok( my $sid_from_string = Net::LDAP::SID->new($sid_string), "new SID" ); is( $sid_from_string->as_string, $sid_string, "->as_string" ); is( $sid_from_string->as_binary, $sid_binary, "->as_binary" ); ok( my $sid_from_binary = Net::LDAP::SID->new($sid_binary), "new SID" ); is( $sid_from_binary->as_string, $sid_string, "->as_string" ); is( $sid_from_binary->as_binary, $sid_binary, "->as_binary" ); }; warn $@ if $@; } Net-LDAP-SID-0.001/t/manifest.t000644 000766 000024 00000000470 12735264067 016300 0ustar00karpetstaff000000 000000 #!perl -T use 5.006; use strict; use warnings; use Test::More; unless ( $ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } my $min_tcm = 0.9; eval "use Test::CheckManifest $min_tcm"; plan skip_all => "Test::CheckManifest $min_tcm required" if $@; ok_manifest(); Net-LDAP-SID-0.001/t/pod-coverage.t000644 000766 000024 00000001250 12735264067 017042 0ustar00karpetstaff000000 000000 #!perl -T use 5.006; use strict; use warnings; use Test::More; unless ( $ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; # Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, # but older versions don't recognize some common documentation styles my $min_pc = 0.18; eval "use Pod::Coverage $min_pc"; plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; all_pod_coverage_ok(); Net-LDAP-SID-0.001/t/pod.t000644 000766 000024 00000000536 12735264067 015257 0ustar00karpetstaff000000 000000 #!perl -T use 5.006; use strict; use warnings; use Test::More; unless ( $ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } # Ensure a recent version of Test::Pod my $min_tp = 1.22; eval "use Test::Pod $min_tp"; plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; all_pod_files_ok(); Net-LDAP-SID-0.001/lib/Net/000755 000766 000024 00000000000 12735512701 015324 5ustar00karpetstaff000000 000000 Net-LDAP-SID-0.001/lib/Net/LDAP/000755 000766 000024 00000000000 12735512701 016044 5ustar00karpetstaff000000 000000 Net-LDAP-SID-0.001/lib/Net/LDAP/SID.pm000644 000766 000024 00000013123 12735511613 017022 0ustar00karpetstaff000000 000000 package Net::LDAP::SID; use strict; use warnings; use Carp; # for reference # https://lists.samba.org/archive/linux/2005-September/014301.html # https://froosh.wordpress.com/2005/10/21/hex-sid-to-decimal-sid-translation/ # https://blogs.msdn.microsoft.com/oldnewthing/20040315-00/?p=40253 # http://www.selfadsi.org/ads-attributes/user-objectSid.htm =head1 NAME Net::LDAP::SID - Active Directory Security Identifier manipulation =cut our $VERSION = '0.001'; =head1 SYNOPSIS my $sid = Net::LDAP::SID->new( $binary ); # or my $sid = Net::LDAP::SID->new( $string ); print $sid->as_string; print $sid->as_binary; =head1 METHODS =head2 new Constructor. Can pass either the binary or string representation of the SID. =cut sub new { my $class = shift; my $bin_or_str = shift or confess "binary or string required"; my $self = bless {}, $class; $self->_build($bin_or_str); $self->_debug() if $ENV{'LDAP_DEBUG'}; return $self; } sub _debug { my $self = shift; warn "SID binary = " . join( '\\', unpack '(H2)*', $self->{binary} ); warn "SID string = $self->{string}"; } sub _build { my ( $self, $bin_or_string ) = @_; if ( substr( $bin_or_string, 0, 1 ) eq 'S' ) { $self->_build_from_string($bin_or_string); } else { $self->_build_from_binary($bin_or_string); } } # SID binary format # byte[0] - revision level # byte[1] - count of sub authorities # byte[2-8] - 48 bit authority (big-endian) # and then count x 32 bit sub authorities (little-endian) my $THIRTY_TWO_BITS = 4294967296; my $PACK_TEMPLATE = 'C C n N V*'; sub _build_from_string { my ( $self, $string ) = @_; my ( undef, $revision_level, $authority, @sub_authorities ) = split /-/, $string; my $sub_authority_count = scalar @sub_authorities; my $auth_id_16 = int( $authority / $THIRTY_TWO_BITS ); my $auth_id_32 = $authority - ( $auth_id_16 * $THIRTY_TWO_BITS ); $self->{binary} = pack $PACK_TEMPLATE, $revision_level, $sub_authority_count, $auth_id_16, $auth_id_32, @sub_authorities; $self->{string} = $string; } sub _build_from_binary { my ( $self, $binary ) = @_; my ( $revision_level, $sub_authority_count, $auth_id_16, $auth_id_32, @sub_authorities ) = unpack $PACK_TEMPLATE, $binary; confess "Invalid SID binary: $binary" if $sub_authority_count != scalar @sub_authorities; my $authority = ( $auth_id_16 * $THIRTY_TWO_BITS ) + $auth_id_32; $self->{string} = join '-', 'S', $revision_level, $authority, @sub_authorities; $self->{binary} = $binary; } =head2 as_string Returns string representation of SID. =head2 as_binary Returns binary representation of SID. =cut sub as_string { shift->{string} } sub as_binary { shift->{binary} } =head1 AUTHOR Peter Karman, C<< >> =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Net::LDAP::SID You can also look for information at: =over 4 =item * RT: CPAN's request tracker (report bugs here) L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =back =head1 LICENSE AND COPYRIGHT Copyright 2016 Peter Karman. This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: L Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =cut 1; # End of Net::LDAP::SID