-/*
+/*
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/>.
*/
}
/**
- * 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)
{
return true;
if (!s1 || !s2)
return false;
-
+
return strcasecmp_m(s1,s2) == 0;
}
-/*
+/*
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/>.
*/
/*
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;
return false;
}
ace->flags = v;
-
+
/* access mask */
ok = sddl_decode_access(tok[2], &ace->access_mask);
if (!ok) {
/* 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;
/* 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;
/*
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)
{
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;
sd->revision = SECURITY_DESCRIPTOR_REVISION_1;
sd->type = SEC_DESC_SELF_RELATIVE;
-
+
while (*sddl) {
uint32_t flags;
char c = sddl[0];
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);
}
}
}
-
+
talloc_free(sidstr);
/* TODO: encode well known sids as two letter codes */
talloc_free(sddl);
return NULL;
}
-
-
-/*
+/*
* 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/>.
*/
/* Now sort the inherited ACEs. */
TYPESAFE_QSORT(&srclist[i], num_aces - i, nt_ace_canon_comp);
}
-
-
-/*
+/*
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/>.
*/
failed:
talloc_free (nacl);
return NULL;
-
+
}
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;
goto failed;
}
}
-
+
if (osd->group_sid) {
nsd->group_sid = dom_sid_dup(nsd, osd->group_sid);
if (nsd->group_sid == NULL) {
/*
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;
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;
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;
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;
}
-/*
+/*
* 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/>.
*/
-/*
+/*
Unix SMB/CIFS implementation.
DOS error code constants
Copyright (C) Andrew Tridgell 1992-2000
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/>.
*/
-/*
+/*
* 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/>.
*/
-/*
- 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/>.
*/
-/*
+/*
* 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
/** 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
{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},
{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},
{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},
{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},
{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},
{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},
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;
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;
}
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;
}
-/*
+/*
Unix SMB/CIFS implementation.
NT error code constants
Copyright (C) Andrew Tridgell 1992-2000
#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)
-/*
+/*
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/>.
*/
/* 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)