From: Volker Lendecke Date: Fri, 3 Mar 2023 17:48:25 +0000 (+0100) Subject: lib: Fix whitespace X-Git-Tag: talloc-2.4.1~1444 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ac2c055614c0aaa63b6c80a12d950d8e5d0cbf0;p=thirdparty%2Fsamba.git lib: Fix whitespace Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/lib/util/util_str.c b/lib/util/util_str.c index 833eb754918..7c1d15dbeb0 100644 --- a/lib/util/util_str.c +++ b/lib/util/util_str.c @@ -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 . */ @@ -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; } diff --git a/libcli/security/sddl.c b/libcli/security/sddl.c index e6c3c94f215..2df1187e6b5 100644 --- a/libcli/security/sddl.c +++ b/libcli/security/sddl.c @@ -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 . */ @@ -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; } - - diff --git a/libcli/security/secace.c b/libcli/security/secace.c index 26c366ac39c..c9ca823ce39 100644 --- a/libcli/security/secace.c +++ b/libcli/security/secace.c @@ -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 . */ @@ -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); } - - diff --git a/libcli/security/security_descriptor.c b/libcli/security/security_descriptor.c index 23d436dbaeb..2d7c5e7a434 100644 --- a/libcli/security/security_descriptor.c +++ b/libcli/security/security_descriptor.c @@ -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 . */ @@ -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;inum_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; } diff --git a/libcli/util/doserr.c b/libcli/util/doserr.c index 99fd72225bf..26c0942a031 100644 --- a/libcli/util/doserr.c +++ b/libcli/util/doserr.c @@ -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 . */ diff --git a/libcli/util/doserr.h b/libcli/util/doserr.h index 12cca12bd6b..b57ac5d58fc 100644 --- a/libcli/util/doserr.h +++ b/libcli/util/doserr.h @@ -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 . */ diff --git a/libcli/util/errmap_unix.c b/libcli/util/errmap_unix.c index 714fead6efc..16c7b4916e7 100644 --- a/libcli/util/errmap_unix.c +++ b/libcli/util/errmap_unix.c @@ -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 . */ diff --git a/libcli/util/error.h b/libcli/util/error.h index 3e74e6edf98..c9082921dad 100644 --- a/libcli/util/error.h +++ b/libcli/util/error.h @@ -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 . */ diff --git a/libcli/util/errormap.c b/libcli/util/errormap.c index 38706195a0c..4907cecced2 100644 --- a/libcli/util/errormap.c +++ b/libcli/util/errormap.c @@ -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 . */ #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; } diff --git a/libcli/util/ntstatus.h b/libcli/util/ntstatus.h index 6262270472d..a6be415a5a6 100644 --- a/libcli/util/ntstatus.h +++ b/libcli/util/ntstatus.h @@ -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) diff --git a/libcli/util/werror.h b/libcli/util/werror.h index d3d3327aef9..365e6d9d963 100644 --- a/libcli/util/werror.h +++ b/libcli/util/werror.h @@ -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 . */ @@ -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)