2005-06-09 02:10:34 +04:00
/*
Unix SMB / CIFS implementation .
Async helpers for blocking functions
Copyright ( C ) Volker Lendecke 2005
2006-07-13 22:10:29 +04:00
Copyright ( C ) Gerald Carter 2006
2008-11-26 16:01:22 +03:00
2005-06-09 02:10:34 +04:00
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
2007-07-09 23:25:36 +04:00
the Free Software Foundation ; either version 3 of the License , or
2005-06-09 02:10:34 +04:00
( at your option ) any later version .
2008-11-26 16:01:22 +03:00
2005-06-09 02:10:34 +04:00
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 .
2008-11-26 16:01:22 +03:00
2005-06-09 02:10:34 +04:00
You should have received a copy of the GNU General Public License
2007-07-10 04:52:41 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2005-06-09 02:10:34 +04:00
*/
# include "includes.h"
# include "winbindd.h"
# undef DBGC_CLASS
# define DBGC_CLASS DBGC_WINBIND
2010-05-21 05:25:01 +04:00
bool print_sidlist ( TALLOC_CTX * mem_ctx , const struct dom_sid * sids ,
2005-10-18 07:24:00 +04:00
size_t num_sids , char * * result , ssize_t * len )
2005-06-09 02:10:34 +04:00
{
2005-10-18 07:24:00 +04:00
size_t i ;
2005-06-09 02:10:34 +04:00
size_t buflen = 0 ;
2005-09-30 21:13:37 +04:00
* len = 0 ;
2005-06-09 02:10:34 +04:00
* result = NULL ;
for ( i = 0 ; i < num_sids ; i + + ) {
2007-12-16 00:00:39 +03:00
fstring tmp ;
2005-09-30 21:13:37 +04:00
sprintf_append ( mem_ctx , result , len , & buflen ,
2007-12-16 00:47:30 +03:00
" %s \n " , sid_to_fstring ( tmp , & sids [ i ] ) ) ;
2005-06-09 02:10:34 +04:00
}
if ( ( num_sids ! = 0 ) & & ( * result = = NULL ) ) {
return False ;
}
return True ;
}
2009-08-02 19:17:27 +04:00
bool parse_sidlist ( TALLOC_CTX * mem_ctx , const char * sidstr ,
2010-05-21 05:25:01 +04:00
struct dom_sid * * sids , size_t * num_sids )
2005-06-09 02:10:34 +04:00
{
2009-08-02 19:17:27 +04:00
const char * p , * q ;
2005-06-09 02:10:34 +04:00
p = sidstr ;
if ( p = = NULL )
2005-09-30 21:13:37 +04:00
return False ;
2005-06-09 02:10:34 +04:00
while ( p [ 0 ] ! = ' \0 ' ) {
2009-08-02 19:17:27 +04:00
fstring tmp ;
size_t sidlen ;
2010-05-21 05:25:01 +04:00
struct dom_sid sid ;
2005-06-09 02:10:34 +04:00
q = strchr ( p , ' \n ' ) ;
if ( q = = NULL ) {
DEBUG ( 0 , ( " Got invalid sidstr: %s \n " , p ) ) ;
return False ;
}
2009-08-02 19:17:27 +04:00
sidlen = PTR_DIFF ( q , p ) ;
if ( sidlen > = sizeof ( tmp ) - 1 ) {
return false ;
}
memcpy ( tmp , p , sidlen ) ;
tmp [ sidlen ] = ' \0 ' ;
2005-06-09 02:10:34 +04:00
q + = 1 ;
2009-08-02 19:17:27 +04:00
if ( ! string_to_sid ( & sid , tmp ) ) {
2005-06-09 02:10:34 +04:00
DEBUG ( 0 , ( " Could not parse sid %s \n " , p ) ) ;
return False ;
}
2008-01-09 02:11:31 +03:00
if ( ! NT_STATUS_IS_OK ( add_sid_to_array ( mem_ctx , & sid , sids ,
num_sids ) ) )
{
2006-12-09 05:58:18 +03:00
return False ;
}
2005-06-09 02:10:34 +04:00
p = q ;
}
return True ;
}
2009-05-16 15:43:03 +04:00
enum winbindd_result winbindd_dual_ping ( struct winbindd_domain * domain ,
struct winbindd_cli_state * state )
{
return WINBINDD_OK ;
}