bool b2;
/* If the ACEs are equal, we have nothing more to do. */
- if (sec_ace_equal(ace1, ace2)) {
+ if (security_ace_equal(ace1, ace2)) {
return 0;
}
TYPESAFE_QSORT(the_acl->aces, the_acl->num_aces, ace_compare);
for (i=1;i<the_acl->num_aces;) {
- if (sec_ace_equal(&the_acl->aces[i-1], &the_acl->aces[i])) {
+ if (security_ace_equal(&the_acl->aces[i-1],
+ &the_acl->aces[i])) {
int j;
for (j=i; j<the_acl->num_aces-1; j++) {
the_acl->aces[j] = the_acl->aces[j+1];
p++;
/* Try to parse numeric form */
- if (sscanf(p, "%i/%i/%i", &atype, &aflags, &amask) == 3 &&
+ if (sscanf(p, "%u/%u/%u", &atype, &aflags, &amask) == 3 &&
convert_string_to_sid(ipc_cli, pol, numeric, &sid, str)) {
goto done;
}
/* Only numeric form accepted for flags at present */
if (!(next_token_talloc(frame, &cp, &tok, "/") &&
- sscanf(tok, "%i", &aflags))) {
+ sscanf(tok, "%u", &aflags))) {
TALLOC_FREE(frame);
return false;
}
}
if (strncmp(tok, "0x", 2) == 0) {
- if (sscanf(tok, "%i", &amask) != 1) {
+ if (sscanf(tok, "%u", &amask) != 1) {
TALLOC_FREE(frame);
return false;
}
status = cli_ntcreate(targetcli, targetpath, 0,
CREATE_ACCESS_READ, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0x0, 0x0, &fnum);
+ FILE_OPEN, 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(5, ("cacl_get failed to open %s: %s\n",
targetpath, nt_errstr(status)));
status = cli_ntcreate(targetcli, targetpath, 0, CREATE_ACCESS_READ, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN,
- 0x0, 0x0, &fnum);
+ 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(5, ("cacl_set failed to open %s: %s\n",
targetpath, nt_errstr(status)));
bool found = False;
for (j=0;old->dacl && j<old->dacl->num_aces;j++) {
- if (sec_ace_equal(&sd->dacl->aces[i],
- &old->dacl->aces[j])) {
+ if (security_ace_equal(&sd->dacl->aces[i],
+ &old->dacl->aces[j])) {
uint32 k;
for (k=j; k<old->dacl->num_aces-1;k++) {
old->dacl->aces[k] =
status = cli_ntcreate(targetcli, targetpath, 0,
WRITE_DAC_ACCESS | WRITE_OWNER_ACCESS, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN,
- 0x0, 0x0, &fnum);
+ 0x0, 0x0, &fnum, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(5, ("cacl_set failed to open %s: %s\n",
targetpath, nt_errstr(status)));
const char * write_time_attr;
const char * change_time_attr;
} attr_strings;
+ uint16_t port = 0;
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
fname,
&workgroup,
&server,
+ &port,
&share,
&path,
&user,
}
srv = SMBC_server(frame, context, True,
- server, share, &workgroup, &user, &password);
+ server, port, share, &workgroup, &user, &password);
if (!srv) {
TALLOC_FREE(frame);
return -1; /* errno set by SMBC_server */
}
if (! srv->no_nt_session) {
- ipc_srv = SMBC_attr_server(frame, context, server, share,
+ ipc_srv = SMBC_attr_server(frame, context, server, port, share,
&workgroup, &user, &password);
if (! ipc_srv) {
srv->no_nt_session = True;
const char * write_time_attr;
const char * change_time_attr;
} attr_strings;
+ uint16_t port = 0;
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
fname,
&workgroup,
&server,
+ &port,
&share,
&path,
&user,
}
srv = SMBC_server(frame, context, True,
- server, share, &workgroup, &user, &password);
+ server, port, share, &workgroup, &user, &password);
if (!srv) {
TALLOC_FREE(frame);
return -1; /* errno set by SMBC_server */
}
if (! srv->no_nt_session) {
- ipc_srv = SMBC_attr_server(frame, context, server, share,
+ ipc_srv = SMBC_attr_server(frame, context, server, port, share,
&workgroup, &user, &password);
+ /*
+ * SMBC_attr_server() can cause the original
+ * server to be removed from the cache.
+ * If so we must error out here as the srv
+ * pointer has been freed.
+ */
+ if (smbc_getFunctionGetCachedServer(context)(context,
+ server,
+ share,
+ workgroup,
+ user) != srv) {
+#if defined(ECONNRESET)
+ errno = ECONNRESET;
+#else
+ errno = ETIMEDOUT;
+#endif
+ TALLOC_FREE(frame);
+ return -1;
+ }
if (! ipc_srv) {
srv->no_nt_session = True;
}
char *password = NULL;
char *workgroup = NULL;
char *path = NULL;
+ uint16_t port = 0;
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
fname,
&workgroup,
&server,
+ &port,
&share,
&path,
&user,
}
srv = SMBC_server(frame, context, True,
- server, share, &workgroup, &user, &password);
+ server, port, share, &workgroup, &user, &password);
if (!srv) {
TALLOC_FREE(frame);
return -1; /* errno set by SMBC_server */
}
if (! srv->no_nt_session) {
- ipc_srv = SMBC_attr_server(frame, context, server, share,
+ int saved_errno;
+ ipc_srv = SMBC_attr_server(frame, context, server, port, share,
&workgroup, &user, &password);
+ saved_errno = errno;
+ /*
+ * SMBC_attr_server() can cause the original
+ * server to be removed from the cache.
+ * If so we must error out here as the srv
+ * pointer has been freed.
+ */
+ if (smbc_getFunctionGetCachedServer(context)(context,
+ server,
+ share,
+ workgroup,
+ user) != srv) {
+#if defined(ECONNRESET)
+ errno = ECONNRESET;
+#else
+ errno = ETIMEDOUT;
+#endif
+ TALLOC_FREE(frame);
+ return -1;
+ }
if (! ipc_srv) {
+ errno = saved_errno;
srv->no_nt_session = True;
}
} else {