*/
#include "includes.h"
+#include "system/filesys.h"
+#include "smbd/smbd.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
#include <afs/venus.h>
#include <afs/prs_fs.h>
-#define MAXSIZE 2048
+#define MAXSIZE 2049
-extern const DOM_SID global_sid_World;
-extern const DOM_SID global_sid_Builtin_Administrators;
-extern const DOM_SID global_sid_Builtin_Backup_Operators;
-extern const DOM_SID global_sid_Authenticated_Users;
-extern const DOM_SID global_sid_NULL;
+extern const struct dom_sid global_sid_World;
+extern const struct dom_sid global_sid_Builtin_Administrators;
+extern const struct dom_sid global_sid_Builtin_Backup_Operators;
+extern const struct dom_sid global_sid_Authenticated_Users;
+extern const struct dom_sid global_sid_NULL;
static char space_replacement = '%';
struct afs_ace {
bool positive;
char *name;
- DOM_SID sid;
+ struct dom_sid sid;
enum lsa_SidType type;
uint32 rights;
struct afs_ace *next;
bool positive,
const char *name, uint32 rights)
{
- DOM_SID sid;
+ struct dom_sid sid;
enum lsa_SidType type;
struct afs_ace *result;
int nplus, nminus;
int aces;
- char str[MAXSIZE+1];
+ char str[MAXSIZE];
char *p = str;
- strncpy(str, acl_str, MAXSIZE);
+ strlcpy(str, acl_str, MAXSIZE);
if (sscanf(p, "%d", &nplus) != 1)
return False;
}
fstr_sprintf(line, "%d\n", positives);
- safe_strcat(acl_str, line, MAXSIZE);
+ strlcat(acl_str, line, MAXSIZE);
fstr_sprintf(line, "%d\n", negatives);
- safe_strcat(acl_str, line, MAXSIZE);
+ strlcat(acl_str, line, MAXSIZE);
ace = acl->acelist;
while (ace != NULL) {
fstr_sprintf(line, "%s\t%d\n", ace->name, ace->rights);
- safe_strcat(acl_str, line, MAXSIZE);
+ strlcat(acl_str, line, MAXSIZE);
ace = ace->next;
}
return True;
static bool same_principal(struct afs_ace *x, struct afs_ace *y)
{
return ( (x->positive == y->positive) &&
- (sid_compare(&x->sid, &y->sid) == 0) );
+ (dom_sid_compare(&x->sid, &y->sid) == 0) );
}
static void merge_afs_acls(struct afs_acl *dir_acl,
/* FULL inherit only -- counterpart to previous one */
{ 0, SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_INHERIT_ONLY,
- PERMS_FULL | GENERIC_RIGHT_WRITE_ACCESS, 127 /* rlidwka */ },
+ PERMS_FULL | SEC_GENERIC_WRITE, 127 /* rlidwka */ },
/* CHANGE without inheritance -- in all cases here we also get
the corresponding INHERIT_ONLY ACE in the same ACL */
/* CHANGE inherit only -- counterpart to previous one */
{ 0, SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_INHERIT_ONLY,
- PERMS_CHANGE | GENERIC_RIGHT_WRITE_ACCESS, 63 /* rlidwk */ },
+ PERMS_CHANGE | SEC_GENERIC_WRITE, 63 /* rlidwk */ },
/* End marker, hopefully there's no afs right 9999 :-) */
{ 0, 0, 0, 9999 }
struct security_descriptor **ppdesc)
{
struct security_ace *nt_ace_list;
- DOM_SID owner_sid, group_sid;
+ struct dom_sid owner_sid, group_sid;
struct security_acl *psa = NULL;
int good_aces;
size_t sd_size;
gid_to_sid(&group_sid, psbuf->st_ex_gid);
if (afs_acl->num_aces) {
- nt_ace_list = TALLOC_ARRAY(mem_ctx, struct security_ace, afs_acl->num_aces);
+ nt_ace_list = talloc_array(mem_ctx, struct security_ace, afs_acl->num_aces);
if (nt_ace_list == NULL)
return 0;
*ppdesc = make_sec_desc(mem_ctx, SD_REVISION,
SEC_DESC_SELF_RELATIVE,
- (security_info & OWNER_SECURITY_INFORMATION)
+ (security_info & SECINFO_OWNER)
? &owner_sid : NULL,
- (security_info & GROUP_SECURITY_INFORMATION)
+ (security_info & SECINFO_GROUP)
? &group_sid : NULL,
NULL, psa, &sd_size);
{
SMB_STRUCT_STAT sbuf;
- if (fsp->is_directory || fsp->fh->fd == -1) {
+ if (fsp->fh->fd == -1) {
/* Get the stat struct for the owner info. */
return afs_to_nt_acl(afs_acl, fsp->conn, fsp->fsp_name,
security_info, ppdesc);
return afs_to_nt_acl_common(afs_acl, &sbuf, security_info, ppdesc);
}
-static bool mappable_sid(const DOM_SID *sid)
+static bool mappable_sid(const struct dom_sid *sid)
{
- DOM_SID domain_sid;
+ struct dom_sid domain_sid;
- if (sid_compare(sid, &global_sid_Builtin_Administrators) == 0)
+ if (dom_sid_compare(sid, &global_sid_Builtin_Administrators) == 0)
return True;
- if (sid_compare(sid, &global_sid_World) == 0)
+ if (dom_sid_compare(sid, &global_sid_World) == 0)
return True;
- if (sid_compare(sid, &global_sid_Authenticated_Users) == 0)
+ if (dom_sid_compare(sid, &global_sid_Authenticated_Users) == 0)
return True;
- if (sid_compare(sid, &global_sid_Builtin_Backup_Operators) == 0)
+ if (dom_sid_compare(sid, &global_sid_Builtin_Backup_Operators) == 0)
return True;
string_to_sid(&domain_sid, "S-1-5-21");
/* Currently we *only* look at the dacl */
- if (((security_info_sent & DACL_SECURITY_INFORMATION) == 0) ||
+ if (((security_info_sent & SECINFO_DACL) == 0) ||
(psd->dacl == NULL))
return True;
continue;
}
- if (sid_compare(&ace->trustee,
+ if (dom_sid_compare(&ace->trustee,
&global_sid_Builtin_Administrators) == 0) {
name = "system:administrators";
- } else if (sid_compare(&ace->trustee,
+ } else if (dom_sid_compare(&ace->trustee,
&global_sid_World) == 0) {
name = "system:anyuser";
- } else if (sid_compare(&ace->trustee,
+ } else if (dom_sid_compare(&ace->trustee,
&global_sid_Authenticated_Users) == 0) {
name = "system:authuser";
- } else if (sid_compare(&ace->trustee,
+ } else if (dom_sid_compare(&ace->trustee,
&global_sid_Builtin_Backup_Operators)
== 0) {
{
struct afs_acl old_afs_acl, new_afs_acl;
struct afs_acl dir_acl, file_acl;
- char acl_string[2049];
+ char acl_string[MAXSIZE];
struct afs_iob iob;
int ret = -1;
char *name = NULL;