1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

lib: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2023-03-03 18:48:25 +01:00 committed by Jeremy Allison
parent 4d8a396c4c
commit 2ac2c05561
11 changed files with 86 additions and 90 deletions

View File

@ -1,22 +1,22 @@
/*
/*
Unix SMB/CIFS implementation.
Samba utility functions
Copyright (C) Andrew Tridgell 1992-2001
Copyright (C) Simo Sorce 2001-2002
Copyright (C) Martin Pool 2003
Copyright (C) James Peach 2005
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 3 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, see <http://www.gnu.org/licenses/>.
*/
@ -59,7 +59,7 @@ _PUBLIC_ bool conv_str_bool(const char * str, bool * val)
}
/**
* Convert a size specification like 16K into an integral number of bytes.
* Convert a size specification like 16K into an integral number of bytes.
**/
_PUBLIC_ bool conv_str_size_error(const char * str, uint64_t * val)
{
@ -132,7 +132,7 @@ _PUBLIC_ bool strequal(const char *s1, const char *s2)
return true;
if (!s1 || !s2)
return false;
return strcasecmp_m(s1,s2) == 0;
}

View File

@ -1,20 +1,20 @@
/*
/*
Unix SMB/CIFS implementation.
security descriptor description language functions
Copyright (C) Andrew Tridgell 2005
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 3 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, see <http://www.gnu.org/licenses/>.
*/
@ -52,7 +52,7 @@ static bool sddl_map_flag(
/*
map a series of letter codes into a uint32_t
*/
static bool sddl_map_flags(const struct flag_map *map, const char *str,
static bool sddl_map_flags(const struct flag_map *map, const char *str,
uint32_t *pflags, size_t *plen)
{
const char *str0 = str;
@ -336,7 +336,7 @@ static bool sddl_decode_ace(TALLOC_CTX *mem_ctx, struct security_ace *ace, char
return false;
}
ace->flags = v;
/* access mask */
ok = sddl_decode_access(tok[2], &ace->access_mask);
if (!ok) {
@ -345,7 +345,7 @@ static bool sddl_decode_ace(TALLOC_CTX *mem_ctx, struct security_ace *ace, char
/* object */
if (tok[3][0] != 0) {
NTSTATUS status = GUID_from_string(tok[3],
NTSTATUS status = GUID_from_string(tok[3],
&ace->object.object.type.type);
if (!NT_STATUS_IS_OK(status)) {
return false;
@ -355,7 +355,7 @@ static bool sddl_decode_ace(TALLOC_CTX *mem_ctx, struct security_ace *ace, char
/* inherit object */
if (tok[4][0] != 0) {
NTSTATUS status = GUID_from_string(tok[4],
NTSTATUS status = GUID_from_string(tok[4],
&ace->object.object.inherited_type.inherited_type);
if (!NT_STATUS_IS_OK(status)) {
return false;
@ -385,7 +385,7 @@ static const struct flag_map acl_flags[] = {
/*
decode an ACL
*/
static struct security_acl *sddl_decode_acl(struct security_descriptor *sd,
static struct security_acl *sddl_decode_acl(struct security_descriptor *sd,
const char **sddlp, uint32_t *flags,
const struct dom_sid *domain_sid)
{
@ -420,13 +420,13 @@ static struct security_acl *sddl_decode_acl(struct security_descriptor *sd,
talloc_free(acl);
return NULL;
}
acl->aces = talloc_realloc(acl, acl->aces, struct security_ace,
acl->aces = talloc_realloc(acl, acl->aces, struct security_ace,
acl->num_aces+1);
if (acl->aces == NULL) {
talloc_free(acl);
return NULL;
}
if (!sddl_decode_ace(acl->aces, &acl->aces[acl->num_aces],
if (!sddl_decode_ace(acl->aces, &acl->aces[acl->num_aces],
astr, domain_sid)) {
talloc_free(acl);
return NULL;
@ -461,7 +461,7 @@ struct security_descriptor *sddl_decode(TALLOC_CTX *mem_ctx, const char *sddl,
sd->revision = SECURITY_DESCRIPTOR_REVISION_1;
sd->type = SEC_DESC_SELF_RELATIVE;
while (*sddl) {
uint32_t flags;
char c = sddl[0];
@ -554,7 +554,7 @@ static char *sddl_encode_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
sidstr = dom_sid_string(mem_ctx, sid);
if (sidstr == NULL) return NULL;
/* seen if its a well known sid */
/* seen if its a well known sid */
for (i=0;sid_codes[i].sid;i++) {
if (strcmp(sidstr, sid_codes[i].sid) == 0) {
talloc_free(sidstr);
@ -572,7 +572,7 @@ static char *sddl_encode_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
}
}
}
talloc_free(sidstr);
/* TODO: encode well known sids as two letter codes */
@ -732,5 +732,3 @@ failed:
talloc_free(sddl);
return NULL;
}

View File

@ -1,21 +1,21 @@
/*
/*
* Unix SMB/Netbios implementation.
* struct security_ace handling functions
* Copyright (C) Andrew Tridgell 1992-1998,
* Copyright (C) Jeremy R. Allison 1995-2003.
* Copyright (C) Luke Kenneth Casson Leighton 1996-1998,
* Copyright (C) Paul Ashton 1997-1998.
*
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
@ -167,5 +167,3 @@ void dacl_sort_into_canonical_order(struct security_ace *srclist, unsigned int n
/* Now sort the inherited ACEs. */
TYPESAFE_QSORT(&srclist[i], num_aces - i, nt_ace_canon_comp);
}

View File

@ -1,20 +1,20 @@
/*
/*
Unix SMB/CIFS implementation.
security descriptror utility functions
Copyright (C) Andrew Tridgell 2004
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 3 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, see <http://www.gnu.org/licenses/>.
*/
@ -87,7 +87,7 @@ struct security_acl *security_acl_dup(TALLOC_CTX *mem_ctx,
failed:
talloc_free (nacl);
return NULL;
}
struct security_acl *security_acl_concatenate(TALLOC_CTX *mem_ctx,
@ -140,10 +140,10 @@ struct security_acl *security_acl_concatenate(TALLOC_CTX *mem_ctx,
}
/*
/*
talloc and copy a security descriptor
*/
struct security_descriptor *security_descriptor_copy(TALLOC_CTX *mem_ctx,
struct security_descriptor *security_descriptor_copy(TALLOC_CTX *mem_ctx,
const struct security_descriptor *osd)
{
struct security_descriptor *nsd;
@ -159,7 +159,7 @@ struct security_descriptor *security_descriptor_copy(TALLOC_CTX *mem_ctx,
goto failed;
}
}
if (osd->group_sid) {
nsd->group_sid = dom_sid_dup(nsd, osd->group_sid);
if (nsd->group_sid == NULL) {
@ -552,7 +552,7 @@ bool security_ace_equal(const struct security_ace *ace1,
/*
compare two security acl structures
*/
bool security_acl_equal(const struct security_acl *acl1,
bool security_acl_equal(const struct security_acl *acl1,
const struct security_acl *acl2)
{
uint32_t i;
@ -565,13 +565,13 @@ bool security_acl_equal(const struct security_acl *acl1,
for (i=0;i<acl1->num_aces;i++) {
if (!security_ace_equal(&acl1->aces[i], &acl2->aces[i])) return false;
}
return true;
return true;
}
/*
compare two security descriptors.
*/
bool security_descriptor_equal(const struct security_descriptor *sd1,
bool security_descriptor_equal(const struct security_descriptor *sd1,
const struct security_descriptor *sd2)
{
if (sd1 == sd2) return true;
@ -584,15 +584,15 @@ bool security_descriptor_equal(const struct security_descriptor *sd1,
if (!security_acl_equal(sd1->sacl, sd2->sacl)) return false;
if (!security_acl_equal(sd1->dacl, sd2->dacl)) return false;
return true;
return true;
}
/*
compare two security descriptors, but allow certain (missing) parts
to be masked out of the comparison
*/
bool security_descriptor_mask_equal(const struct security_descriptor *sd1,
const struct security_descriptor *sd2,
bool security_descriptor_mask_equal(const struct security_descriptor *sd1,
const struct security_descriptor *sd2,
uint32_t mask)
{
if (sd1 == sd2) return true;
@ -605,7 +605,7 @@ bool security_descriptor_mask_equal(const struct security_descriptor *sd1,
if ((mask & SEC_DESC_DACL_PRESENT) && !security_acl_equal(sd1->dacl, sd2->dacl)) return false;
if ((mask & SEC_DESC_SACL_PRESENT) && !security_acl_equal(sd1->sacl, sd2->sacl)) return false;
return true;
return true;
}

View File

@ -1,18 +1,18 @@
/*
/*
* Unix SMB/CIFS implementation.
* DOS error routines
* Copyright (C) Tim Potter 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 3 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, see <http://www.gnu.org/licenses/>.
*/

View File

@ -1,4 +1,4 @@
/*
/*
Unix SMB/CIFS implementation.
DOS error code constants
Copyright (C) Andrew Tridgell 1992-2000
@ -6,17 +6,17 @@
Copyright (C) Luke Kenneth Casson Leighton 1996-2000
Copyright (C) Paul Ashton 1998-2000
Copyright (C) Gerald (Jerry) Carter 2005
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 3 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, see <http://www.gnu.org/licenses/>.
*/

View File

@ -1,20 +1,20 @@
/*
/*
* Unix SMB/CIFS implementation.
* error mapping functions
* Copyright (C) Andrew Tridgell 2001
* Copyright (C) Andrew Bartlett 2001
* Copyright (C) Tim Potter 2000
*
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/

View File

@ -1,17 +1,17 @@
/*
Unix SMB/CIFS implementation.
/*
Unix SMB/CIFS implementation.
Error handling code
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 3 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, see <http://www.gnu.org/licenses/>.
*/

View File

@ -1,37 +1,37 @@
/*
/*
* Unix SMB/CIFS implementation.
* error mapping functions
* Copyright (C) Andrew Tridgell 2001
* Copyright (C) Andrew Bartlett 2001
* Copyright (C) Tim Potter 2000
*
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
/* This map was extracted by the ERRMAPEXTRACT smbtorture command.
The setup was a Samba HEAD (2002-01-03) PDC and an Win2k member
/* This map was extracted by the ERRMAPEXTRACT smbtorture command.
The setup was a Samba HEAD (2002-01-03) PDC and an Win2k member
workstation. The PDC was modified (by using the 'name_to_nt_status'
authentication module) to convert the username (in hex) into the
corresponding NTSTATUS error return.
corresponding NTSTATUS error return.
By opening two nbt sessions to the Win2k workstation, one negotiating
DOS and one negotiating NT errors it was possible to extract the
error mapping. (Because the server only supplies NT errors, the
error mapping. (Because the server only supplies NT errors, the
NT4 workstation had to use its own error tables to convert these
to dos errors).
to dos errors).
Some errors show up as 'squashed' because the NT error connection
got back a different error to the one it sent, so a mapping could
@ -81,7 +81,7 @@ static const struct {
/** Session setup succeeded. This shouldn't happen...*/
/** NT error on DOS connection! (NT_STATUS_OK) */
/* { This NT error code was 'sqashed'
from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK
from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK
during the session setup }
*/
#if 0
@ -99,7 +99,7 @@ static const struct {
{ERRDOS, 193, NT_STATUS_INVALID_FILE_FOR_SECTION},
{ERRDOS, ERRnoaccess, NT_STATUS_ALREADY_COMMITTED},
/* { This NT error code was 'sqashed'
from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
during the session setup }
*/
{ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED},
@ -169,7 +169,7 @@ static const struct {
{ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACCOUNT_NAME},
{ERRHRD, ERRgeneral, NT_STATUS_USER_EXISTS},
/* { This NT error code was 'sqashed'
from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE
from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE
during the session setup }
*/
{ERRDOS, ERRnoaccess, NT_STATUS_NO_SUCH_USER},
@ -179,7 +179,7 @@ static const struct {
{ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_GROUP},
{ERRHRD, ERRgeneral, NT_STATUS_LAST_ADMIN},
/* { This NT error code was 'sqashed'
from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE
from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE
during the session setup }
*/
{ERRSRV, ERRbadpw, NT_STATUS_WRONG_PASSWORD},
@ -232,7 +232,7 @@ static const struct {
{ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID},
{ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED},
/* { This NT error code was 'sqashed'
from NT_STATUS_INSUFFICIENT_RESOURCES to NT_STATUS_INSUFF_SERVER_RESOURCES
from NT_STATUS_INSUFFICIENT_RESOURCES to NT_STATUS_INSUFF_SERVER_RESOURCES
during the session setup }
*/
{ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES},
@ -477,7 +477,7 @@ static const struct {
{ERRDOS, 19, NT_STATUS_TOO_LATE},
{ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET},
/* { This NT error code was 'sqashed'
from NT_STATUS_NO_TRUST_SAM_ACCOUNT to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
from NT_STATUS_NO_TRUST_SAM_ACCOUNT to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
during the session setup }
*/
{ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT},
@ -497,7 +497,7 @@ static const struct {
{ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT},
{ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT},
/* { This NT error code was 'sqashed'
from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE
from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE
during the session setup }
*/
{ERRDOS, ERRnoaccess, NT_STATUS_DOMAIN_TRUST_INCONSISTENT},
@ -1183,7 +1183,7 @@ void ntstatus_to_dos(NTSTATUS ntstatus, uint8_t *eclass, uint32_t *ecode)
return;
}
for (i=0; NT_STATUS_V(ntstatus_to_dos_map[i].ntstatus); i++) {
if (NT_STATUS_V(ntstatus) ==
if (NT_STATUS_V(ntstatus) ==
NT_STATUS_V(ntstatus_to_dos_map[i].ntstatus)) {
*eclass = ntstatus_to_dos_map[i].dos_class;
*ecode = ntstatus_to_dos_map[i].dos_code;
@ -1204,14 +1204,14 @@ NTSTATUS werror_to_ntstatus(WERROR error)
if (W_ERROR_IS_OK(error)) return NT_STATUS_OK;
for (i=0; !W_ERROR_IS_OK(werror_to_ntstatus_map[i].werror); i++) {
if (W_ERROR_V(error) ==
if (W_ERROR_V(error) ==
W_ERROR_V(werror_to_ntstatus_map[i].werror)) {
return werror_to_ntstatus_map[i].ntstatus;
}
}
for (i=0; NT_STATUS_V(ntstatus_to_werror_map[i].ntstatus); i++) {
if (W_ERROR_V(error) ==
if (W_ERROR_V(error) ==
W_ERROR_V(ntstatus_to_werror_map[i].werror)) {
return ntstatus_to_werror_map[i].ntstatus;
}
@ -1229,7 +1229,7 @@ WERROR ntstatus_to_werror(NTSTATUS error)
int i;
if (NT_STATUS_IS_OK(error)) return WERR_OK;
for (i=0; NT_STATUS_V(ntstatus_to_werror_map[i].ntstatus); i++) {
if (NT_STATUS_V(error) ==
if (NT_STATUS_V(error) ==
NT_STATUS_V(ntstatus_to_werror_map[i].ntstatus)) {
return ntstatus_to_werror_map[i].werror;
}

View File

@ -1,4 +1,4 @@
/*
/*
Unix SMB/CIFS implementation.
NT error code constants
Copyright (C) Andrew Tridgell 1992-2000
@ -25,10 +25,10 @@
#include "libcli/util/ntstatus_gen.h"
/* the following rather strange looking definitions of NTSTATUS
/* the following rather strange looking definitions of NTSTATUS
are there in order to catch common coding errors where different error types
are mixed up. This is especially important as we slowly convert Samba
from using bool for internal functions
from using bool for internal functions
*/
#if defined(HAVE_IMMEDIATE_STRUCTURES)

View File

@ -1,19 +1,19 @@
/*
/*
Unix SMB/CIFS implementation.
SMB parameters and setup, plus a whole lot more.
Copyright (C) Andrew Tridgell 2001
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 3 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, see <http://www.gnu.org/licenses/>.
*/
@ -26,7 +26,7 @@
/* the following rather strange looking definitions of NTSTATUS and WERROR
and there in order to catch common coding errors where different error types
are mixed up. This is especially important as we slowly convert Samba
from using bool for internal functions
from using bool for internal functions
*/
#if defined(HAVE_IMMEDIATE_STRUCTURES)