mirror of
https://github.com/samba-team/samba.git
synced 2024-12-28 07:21:54 +03:00
removing unused files
This commit is contained in:
parent
c17a7dc9a1
commit
1a9145015d
@ -1,59 +0,0 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
LDAP protocol helper functions for SAMBA
|
||||
Copyright (C) Jean François Micouleau 1998
|
||||
Copyright (C) Gerald Carter 2001
|
||||
Copyright (C) Shahms King 2001
|
||||
Copyright (C) Andrew Bartlett 2002
|
||||
Copyright (C) Stefan (metze) Metzmacher 2002
|
||||
Copyright (C) Jim McDonough 2003
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef SMB_LDAP_H
|
||||
#define SMB_LDAP_H
|
||||
|
||||
#ifdef HAVE_LDAP
|
||||
|
||||
#include <lber.h>
|
||||
#include <ldap.h>
|
||||
|
||||
struct smb_ldap_privates {
|
||||
|
||||
/* Former statics */
|
||||
LDAP *ldap_struct;
|
||||
LDAPMessage *result;
|
||||
LDAPMessage *entry;
|
||||
int index;
|
||||
|
||||
time_t last_ping;
|
||||
/* retrive-once info */
|
||||
const char *uri;
|
||||
|
||||
BOOL permit_non_unix_accounts;
|
||||
|
||||
uint32 low_nua_rid;
|
||||
uint32 high_nua_rid;
|
||||
|
||||
char *bind_dn;
|
||||
char *bind_secret;
|
||||
|
||||
struct smb_ldap_privates *next;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
@ -1,172 +0,0 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
Universal groups helpers
|
||||
Copyright (C) Alexander Bokovoy 2002.
|
||||
Copyright (C) Andrew Bartlett 2002.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
This work was sponsored by Optifacio Software Services, Inc.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#define UNIGROUP_PREFIX "UNIGROUP"
|
||||
|
||||
/*
|
||||
Handle for netlogon_unigrp.tdb database. It is used internally
|
||||
in cli_store_uni_groups_*() and cli_fetch_uni_groups()
|
||||
and is initialized on first call to cli_store_uni_groups_*()
|
||||
*/
|
||||
static TDB_CONTEXT *netlogon_unigrp_tdb = NULL;
|
||||
|
||||
/*
|
||||
Store universal groups info into netlogon_unigrp.tdb for
|
||||
later usage. We use 'domain_SID/user_rid' as key and
|
||||
array of uint32 where array[0] is number of elements
|
||||
and elements are array[1] ... array[array[0]]
|
||||
*/
|
||||
|
||||
BOOL uni_group_cache_init(void)
|
||||
{
|
||||
if (!netlogon_unigrp_tdb) {
|
||||
netlogon_unigrp_tdb = tdb_open_log(lock_path("netlogon_unigrp.tdb"), 0,
|
||||
TDB_DEFAULT, O_RDWR | O_CREAT, 0644);
|
||||
}
|
||||
|
||||
return (netlogon_unigrp_tdb != NULL);
|
||||
}
|
||||
|
||||
BOOL uni_group_cache_store_netlogon(TALLOC_CTX *mem_ctx, NET_USER_INFO_3 *user)
|
||||
{
|
||||
TDB_DATA key,data;
|
||||
fstring keystr, sid_string;
|
||||
DOM_SID user_sid;
|
||||
unsigned int i;
|
||||
|
||||
if (!uni_group_cache_init()) {
|
||||
DEBUG(0,("uni_group_cache_store_netlogon: cannot open netlogon_unigrp.tdb for write!\n"));
|
||||
return False;
|
||||
}
|
||||
|
||||
sid_copy(&user_sid, &user->dom_sid.sid);
|
||||
sid_append_rid(&user_sid, user->user_rid);
|
||||
|
||||
/* Prepare key as USER-SID string */
|
||||
slprintf(keystr, sizeof(keystr), "%s/%s",
|
||||
UNIGROUP_PREFIX,
|
||||
sid_to_string(sid_string, &user_sid));
|
||||
key.dptr = keystr;
|
||||
key.dsize = strlen(keystr) + 1;
|
||||
|
||||
/* Prepare data */
|
||||
data.dsize = (user->num_groups2+1)*sizeof(uint32);
|
||||
data.dptr = talloc(mem_ctx, data.dsize);
|
||||
if(!data.dptr) {
|
||||
DEBUG(0,("uni_group_cache_store_netlogon: cannot allocate memory!\n"));
|
||||
talloc_destroy(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
/* Store data in byteorder-independent format */
|
||||
SIVAL(&((uint32*)data.dptr)[0],0,user->num_groups2);
|
||||
for(i=1; i<=user->num_groups2; i++) {
|
||||
SIVAL(&((uint32*)data.dptr)[i],0,user->gids[i-1].g_rid);
|
||||
}
|
||||
if (tdb_store(netlogon_unigrp_tdb, key, data, TDB_REPLACE) == -1)
|
||||
return False;
|
||||
return True;
|
||||
}
|
||||
|
||||
/*
|
||||
Fetch universal groups info from netlogon_unigrp.tdb for given
|
||||
domain sid and user rid and allocate it using given mem_ctx.
|
||||
Universal groups are returned as array of uint32 elements
|
||||
and elements are array[0] ... array[num_elements-1]
|
||||
|
||||
*/
|
||||
DOM_SID **uni_group_cache_fetch(DOM_SID *domain, DOM_SID *user_sid,
|
||||
TALLOC_CTX *mem_ctx, uint32 *num_groups)
|
||||
{
|
||||
TDB_DATA key,data;
|
||||
fstring keystr;
|
||||
DOM_SID **groups;
|
||||
uint32 i;
|
||||
uint32 group_count;
|
||||
fstring sid_string;
|
||||
|
||||
if (!domain) {
|
||||
DEBUG(1,("uni_group_cache_fetch: expected non-null domain sid\n"));
|
||||
return NULL;
|
||||
}
|
||||
if (!mem_ctx) {
|
||||
DEBUG(1,("uni_group_cache_fetch: expected non-null memory context\n"));
|
||||
return NULL;
|
||||
}
|
||||
if (!num_groups) {
|
||||
DEBUG(1,("uni_group_cache_fetch: expected non-null num_groups\n"));
|
||||
return NULL;
|
||||
}
|
||||
if (!netlogon_unigrp_tdb) {
|
||||
netlogon_unigrp_tdb = tdb_open_log(lock_path("netlogon_unigrp.tdb"), 0,
|
||||
TDB_DEFAULT, O_RDWR, 0644);
|
||||
}
|
||||
if (!netlogon_unigrp_tdb) {
|
||||
DEBUG(5,("uni_group_cache_fetch: cannot open netlogon_unigrp.tdb for read - normal if not created yet\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*num_groups = 0;
|
||||
|
||||
/* Fetch universal groups */
|
||||
slprintf(keystr, sizeof(keystr), "%s/%s",
|
||||
UNIGROUP_PREFIX,
|
||||
sid_to_string(sid_string, user_sid));
|
||||
key.dptr = keystr;
|
||||
key.dsize = strlen(keystr) + 1;
|
||||
data = tdb_fetch(netlogon_unigrp_tdb, key);
|
||||
|
||||
/* There is no cached universal groups in netlogon_unigrp.tdb */
|
||||
/* for this user. */
|
||||
if (!data.dptr)
|
||||
return NULL;
|
||||
|
||||
/* Transfer data to receiver's memory context */
|
||||
group_count = IVAL(&((uint32*)data.dptr)[0],0);
|
||||
groups = talloc(mem_ctx, (group_count)*sizeof(*groups));
|
||||
if (groups) {
|
||||
for(i=0; i<group_count; i++) {
|
||||
groups[i] = talloc(mem_ctx, sizeof(**groups));
|
||||
if (!groups[i]) {
|
||||
DEBUG(1,("uni_group_cache_fetch: cannot allocate uni groups in receiver's memory context\n"));
|
||||
return NULL;
|
||||
}
|
||||
sid_copy(groups[i], domain);
|
||||
sid_append_rid(groups[i], IVAL(&((uint32*)data.dptr)[i+1],0));
|
||||
}
|
||||
} else {
|
||||
DEBUG(1,("uni_group_cache_fetch: cannot allocate uni groups in receiver's memory context\n"));
|
||||
}
|
||||
SAFE_FREE(data.dptr);
|
||||
*num_groups = group_count;
|
||||
return groups;
|
||||
}
|
||||
|
||||
/* Shutdown netlogon_unigrp database */
|
||||
BOOL uni_group_cache_shutdown(void)
|
||||
{
|
||||
if(netlogon_unigrp_tdb)
|
||||
return (tdb_close(netlogon_unigrp_tdb) == 0);
|
||||
return True;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,131 +0,0 @@
|
||||
/*
|
||||
* Unix password backend for samba
|
||||
* Copyright (C) Jelmer Vernooij 2002
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc., 675
|
||||
* Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
/******************************************************************
|
||||
Lookup a name in the SAM database
|
||||
******************************************************************/
|
||||
|
||||
static NTSTATUS unixsam_getsampwnam (struct pdb_methods *methods, SAM_ACCOUNT *user, const char *sname)
|
||||
{
|
||||
struct passwd *pass;
|
||||
if (!methods) {
|
||||
DEBUG(0,("invalid methods\n"));
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
if (!sname) {
|
||||
DEBUG(0,("invalid name specified"));
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
pass = Get_Pwnam(sname);
|
||||
|
||||
return pdb_fill_sam_pw(user, pass);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
Search by rid
|
||||
**************************************************************************/
|
||||
|
||||
static NTSTATUS unixsam_getsampwrid (struct pdb_methods *methods,
|
||||
SAM_ACCOUNT *user, uint32 rid)
|
||||
{
|
||||
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
|
||||
struct passwd *pass = NULL;
|
||||
const char *guest_account = lp_guestaccount();
|
||||
if (!(guest_account && *guest_account)) {
|
||||
DEBUG(1, ("NULL guest account!?!?\n"));
|
||||
return nt_status;
|
||||
}
|
||||
|
||||
if (!methods) {
|
||||
DEBUG(0,("invalid methods\n"));
|
||||
return nt_status;
|
||||
}
|
||||
|
||||
if (rid == DOMAIN_USER_RID_GUEST) {
|
||||
pass = getpwnam_alloc(guest_account);
|
||||
if (!pass) {
|
||||
DEBUG(1, ("guest account %s does not seem to exist...\n", guest_account));
|
||||
return nt_status;
|
||||
}
|
||||
} else if (fallback_pdb_rid_is_user(rid)) {
|
||||
pass = getpwuid_alloc(fallback_pdb_user_rid_to_uid (rid));
|
||||
}
|
||||
|
||||
if (pass == NULL) {
|
||||
return nt_status;
|
||||
}
|
||||
|
||||
nt_status = pdb_fill_sam_pw(user, pass);
|
||||
passwd_free(&pass);
|
||||
|
||||
return nt_status;
|
||||
}
|
||||
|
||||
static NTSTATUS unixsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, const DOM_SID *sid)
|
||||
{
|
||||
uint32 rid;
|
||||
if (!sid_peek_check_rid(get_global_sam_sid(), sid, &rid))
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
return unixsam_getsampwrid(my_methods, user, rid);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
Updates a SAM_ACCOUNT
|
||||
|
||||
This isn't a particulary practical option for pdb_unix. We certainly don't
|
||||
want to twidde the filesystem, so what should we do?
|
||||
|
||||
Current plan is to transparently add the account. It should appear
|
||||
as if the pdb_unix version was modified, but its actually stored somehwere.
|
||||
****************************************************************************/
|
||||
|
||||
static NTSTATUS unixsam_update_sam_account (struct pdb_methods *methods, SAM_ACCOUNT *newpwd)
|
||||
{
|
||||
return methods->parent->pdb_add_sam_account(methods->parent, newpwd);
|
||||
}
|
||||
|
||||
NTSTATUS pdb_init_unixsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
|
||||
{
|
||||
NTSTATUS nt_status;
|
||||
|
||||
if (!pdb_context) {
|
||||
DEBUG(0, ("invalid pdb_context specified\n"));
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
if (!NT_STATUS_IS_OK(nt_status = make_pdb_methods(pdb_context->mem_ctx, pdb_method))) {
|
||||
return nt_status;
|
||||
}
|
||||
|
||||
(*pdb_method)->name = "unixsam";
|
||||
(*pdb_method)->update_sam_account = unixsam_update_sam_account;
|
||||
(*pdb_method)->getsampwnam = unixsam_getsampwnam;
|
||||
(*pdb_method)->getsampwsid = unixsam_getsampwsid;
|
||||
|
||||
/* There's not very much to initialise here */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS pdb_unix_init(void)
|
||||
{
|
||||
return smb_register_passdb(PASSDB_INTERFACE_VERSION, "unixsam", pdb_init_unixsam);
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
my ( $tag, $filename, $date );
|
||||
my ( $tmp, $change_flag );
|
||||
|
||||
if ( $#ARGV != 2 ) {
|
||||
|
||||
print "Usage: ", $0, " cvstag date file\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
$tag = $ARGV[0];
|
||||
$date = $ARGV[1];
|
||||
$filename = $ARGV[2];
|
||||
|
||||
print STDERR "$filename\n";
|
||||
|
||||
open ( CVSLOG, "cvs log -d\"$date\" $filename |" ) || die $!;
|
||||
|
||||
##
|
||||
## First get the branch revision number
|
||||
##
|
||||
undef $revision;
|
||||
while ( !defined($revision) ) {
|
||||
if ( eof( \*CVSLOG ) ) {
|
||||
print STDERR "Premature end of cvs log output!\n";
|
||||
exit (1);
|
||||
}
|
||||
|
||||
$string = <CVSLOG>;
|
||||
chomp( $string );
|
||||
|
||||
if ( $string =~ /$tag:/ ) {
|
||||
( $tmp, $revision ) = split( /:/, $string );
|
||||
$revision =~ s/\s+//g;
|
||||
$revision =~ s/\.0\./\./g;
|
||||
}
|
||||
}
|
||||
|
||||
##
|
||||
## Setup the beginning of the first record
|
||||
##
|
||||
$string = "";
|
||||
while ( $string !~ /^-+/ ) {
|
||||
$string = <CVSLOG>;
|
||||
exit(0) if ( eof(\*CVSLOG) );
|
||||
}
|
||||
|
||||
##
|
||||
## Loop starting at the revision number for the entry
|
||||
##
|
||||
|
||||
while ( $string = <CVSLOG> ) {
|
||||
|
||||
($tmp, $entry_rev) = split( /\s+/, $string );
|
||||
if ( equal_revision( $revision, $entry_rev ) ) {
|
||||
if ( ! defined($change_flag) ) {
|
||||
print "++++++++++++++++++++++++++++++++++++++++++++++++++\n";
|
||||
print "## $filename\n";
|
||||
print "++\n";
|
||||
$change_flag = 1;
|
||||
}
|
||||
|
||||
while ( $string !~ /^-+/ && !eof(CVSLOG) ) {
|
||||
print "$string";
|
||||
$string = <CVSLOG>;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while ( ($string !~ /^-+/) && !eof(CVSLOG) ) {
|
||||
$string = <CVSLOG>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close( CVSLOG );
|
||||
exit 0;
|
||||
|
||||
##############################################################
|
||||
##
|
||||
sub equal_revision {
|
||||
my ( $branch, $newfile ) = @_;
|
||||
my ( $indx );
|
||||
my ( @branch_rev, @file_rev );
|
||||
|
||||
@branch_rev = split( /\./, $branch );
|
||||
@file_rev = split( /\./, $newfile );
|
||||
|
||||
return 0 if ( $#branch_rev != ($#file_rev - 1) );
|
||||
|
||||
$indx = 0;
|
||||
while( $indx <= $#branch_rev ) {
|
||||
if ( $branch_rev[$indx] != $file_rev[$indx] ) {
|
||||
return 0;
|
||||
}
|
||||
$indx++;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user