SMBCSRV *srv = NULL;
SMBCFILE *file = NULL;
int fd;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL; /* Best I can think of ... */
+ TALLOC_FREE(frame);
return NULL;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return NULL;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return NULL;
}
if (!srv) {
if (errno == EPERM) errno = EACCES;
+ TALLOC_FREE(frame);
return NULL; /* smbc_server sets errno */
}
if (!file) {
errno = ENOMEM;
+ TALLOC_FREE(frame);
return NULL;
}
{
d_printf("Could not resolve %s\n", path);
SAFE_FREE(file);
+ TALLOC_FREE(frame);
return NULL;
}
/*d_printf(">>>open: resolved %s as %s\n", path, targetpath);*/
SAFE_FREE(file);
errno = smbc_errno(context, targetcli);
+ TALLOC_FREE(frame);
return NULL;
}
if (smbc_lseek_ctx(context, file, 0, SEEK_END) < 0) {
(void) smbc_close_ctx(context, file);
errno = ENXIO;
+ TALLOC_FREE(frame);
return NULL;
}
}
+ TALLOC_FREE(frame);
return file;
}
eno = smbc_errno(context, srv->cli);
file = (context->opendir)(context, fname);
if (!file) errno = eno;
+ TALLOC_FREE(frame);
return file;
}
errno = EINVAL; /* FIXME, correct errno ? */
+ TALLOC_FREE(frame);
return NULL;
}
fstring server, share, user, password;
pstring path, targetpath;
struct cli_state *targetcli;
+ TALLOC_CTX *frame = talloc_stackframe();
/*
* offset:
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!file || !DLIST_CONTAINS(context->internal->_files, file)) {
errno = EBADF;
+ TALLOC_FREE(frame);
return -1;
}
if (buf == NULL) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
&targetcli, targetpath))
{
d_printf("Could not resolve %s\n", path);
+ TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>fstat: resolved path as %s\n", targetpath);*/
if (ret < 0) {
errno = smbc_errno(context, targetcli);
+ TALLOC_FREE(frame);
return -1;
}
DEBUG(4, (" --> %d\n", ret));
+ TALLOC_FREE(frame);
return ret; /* Success, ret bytes of data ... */
}
fstring server, share, user, password;
pstring path, targetpath;
struct cli_state *targetcli;
+ TALLOC_CTX *frame = talloc_stackframe();
/* First check all pointers before dereferencing them */
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!file || !DLIST_CONTAINS(context->internal->_files, file)) {
errno = EBADF;
+ TALLOC_FREE(frame);
return -1;
}
if (buf == NULL) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
&targetcli, targetpath))
{
d_printf("Could not resolve %s\n", path);
+ TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>write: resolved path as %s\n", targetpath);*/
if (ret <= 0) {
errno = smbc_errno(context, targetcli);
+ TALLOC_FREE(frame);
return -1;
}
file->offset += ret;
+ TALLOC_FREE(frame);
return ret; /* Success, 0 bytes of data ... */
}
fstring server, share, user, password;
pstring path, targetpath;
struct cli_state *targetcli;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!file || !DLIST_CONTAINS(context->internal->_files, file)) {
errno = EBADF;
+ TALLOC_FREE(frame);
return -1;
}
/* IS a dir ... */
if (!file->file) {
+ TALLOC_FREE(frame);
return (context->closedir)(context, file);
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
&targetcli, targetpath))
{
d_printf("Could not resolve %s\n", path);
+ TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>close: resolved path as %s\n", targetpath);*/
SAFE_FREE(file->fname);
SAFE_FREE(file);
(context->callbacks.remove_unused_server_fn)(context, srv);
-
+ TALLOC_FREE(frame);
return -1;
}
DLIST_REMOVE(context->internal->_files, file);
SAFE_FREE(file->fname);
SAFE_FREE(file);
+ TALLOC_FREE(frame);
return 0;
}
pstring targetpath;
struct cli_state *targetcli;
time_t write_time;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!cli_resolve_path( "", srv->cli, fixedpath, &targetcli, targetpath))
{
d_printf("Couldn't resolve %s\n", path);
+ TALLOC_FREE(frame);
return False;
}
write_time_ts,
change_time_ts,
size, mode, ino)) {
- return True;
+ TALLOC_FREE(frame);
+ return True;
}
/* if this is NT then don't bother with the getatr */
if (targetcli->capabilities & CAP_NT_SMBS) {
errno = EPERM;
+ TALLOC_FREE(frame);
return False;
}
}
srv->no_pathinfo2 = True;
+ TALLOC_FREE(frame);
return True;
}
errno = EPERM;
+ TALLOC_FREE(frame);
return False;
}
{
int fd;
int ret;
+ TALLOC_CTX *frame = talloc_stackframe();
/*
* First, try setpathinfo (if qpathinfo succeeded), for it is the
if ((fd = cli_open(srv->cli, path, O_RDWR, DENY_NONE)) < 0) {
errno = smbc_errno(context, srv->cli);
+ TALLOC_FREE(frame);
return -1;
}
if (! ret) {
errno = smbc_errno(context, srv->cli);
+ TALLOC_FREE(frame);
return False;
}
}
+ TALLOC_FREE(frame);
return True;
}
pstring path, targetpath;
struct cli_state *targetcli;
SMBCSRV *srv = NULL;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL; /* Best I can think of ... */
+ TALLOC_FREE(frame);
return -1;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!srv) {
+ TALLOC_FREE(frame);
return -1; /* smbc_server sets errno */
}
if (!cli_resolve_path( "", srv->cli, path, &targetcli, targetpath))
{
d_printf("Could not resolve %s\n", path);
+ TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>unlink: resolved path as %s\n", targetpath);*/
/* Hmmm, bad error ... What? */
errno = smbc_errno(context, targetcli);
+ TALLOC_FREE(frame);
return -1;
}
}
}
+ TALLOC_FREE(frame);
return -1;
}
+ TALLOC_FREE(frame);
return 0; /* Success ... */
}
struct cli_state *targetcli1;
struct cli_state *targetcli2;
SMBCSRV *srv = NULL;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!ocontext || !ncontext ||
!ocontext->internal || !ncontext->internal ||
!ncontext->internal->_initialized) {
errno = EINVAL; /* Best I can think of ... */
+ TALLOC_FREE(frame);
return -1;
}
if (!oname || !nname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
/* Can't rename across file systems, or users?? */
errno = EXDEV;
+ TALLOC_FREE(frame);
return -1;
}
server1, share1, workgroup, user1, password1);
if (!srv) {
+ TALLOC_FREE(frame);
return -1;
}
if (!cli_resolve_path( "", srv->cli, path1, &targetcli1, targetpath1))
{
d_printf("Could not resolve %s\n", path1);
+ TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>rename: resolved path as %s\n", targetpath1);*/
if (!cli_resolve_path( "", srv->cli, path2, &targetcli2, targetpath2))
{
d_printf("Could not resolve %s\n", path2);
+ TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>rename: resolved path as %s\n", targetpath2);*/
/* can't rename across file systems */
errno = EXDEV;
+ TALLOC_FREE(frame);
return -1;
}
!cli_rename(targetcli1, targetpath1, targetpath2)) {
errno = eno;
+ TALLOC_FREE(frame);
return -1;
}
}
+ TALLOC_FREE(frame);
return 0; /* Success */
-
}
/*
fstring server, share, user, password;
pstring path, targetpath;
struct cli_state *targetcli;
+ TALLOC_CTX *frame = talloc_tos();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!file || !DLIST_CONTAINS(context->internal->_files, file)) {
errno = EBADF;
+ TALLOC_FREE(frame);
return -1;
}
if (!file->file) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1; /* Can't lseek a dir ... */
}
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
&targetcli, targetpath))
{
d_printf("Could not resolve %s\n", path);
+ TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>lseek: resolved path as %s\n", targetpath);*/
NULL, &b_size, NULL, NULL, NULL))
{
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
} else
size = b_size;
}
+ TALLOC_FREE(frame);
return file->offset;
}
smbc_inode(SMBCCTX *context,
const char *name)
{
-
if (!context || !context->internal ||
!context->internal->_initialized) {
SMB_OFF_T size,
int mode)
{
+ TALLOC_CTX *frame = talloc_stackframe();
st->st_mode = 0;
st->st_ino = smbc_inode(context, fname);
}
+ TALLOC_FREE(frame);
return True; /* FIXME: Is this needed ? */
}
SMB_OFF_T size = 0;
uint16 mode = 0;
SMB_INO_T ino = 0;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL; /* Best I can think of ... */
+ TALLOC_FREE(frame);
return -1;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
server, share, workgroup, user, password);
if (!srv) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_server */
}
&ino)) {
errno = smbc_errno(context, srv->cli);
+ TALLOC_FREE(frame);
return -1;
}
set_mtimespec(st, write_time_ts);
st->st_dev = srv->dev;
+ TALLOC_FREE(frame);
return 0;
}
pstring targetpath;
struct cli_state *targetcli;
SMB_INO_T ino = 0;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!file || !DLIST_CONTAINS(context->internal->_files, file)) {
errno = EBADF;
+ TALLOC_FREE(frame);
return -1;
}
if (!file->file) {
+ TALLOC_FREE(frame);
return (context->fstatdir)(context, file, st);
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
&targetcli, targetpath))
{
d_printf("Could not resolve %s\n", path);
+ TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>fstat: resolved path as %s\n", targetpath);*/
&change_time, &access_time, &write_time)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
set_mtimespec(st, write_time_ts);
st->st_dev = file->srv->dev;
+ TALLOC_FREE(frame);
return 0;
}
SRV_SHARE_INFO_CTR ctr;
fstring name = "";
fstring comment = "";
- void *mem_ctx;
struct rpc_pipe_client *pipe_hnd;
NTSTATUS nt_status;
return -1;
}
- /* Allocate a context for parsing and for the entries in "ctr" */
- mem_ctx = talloc_init("libsmbclient: net_share_enum_rpc");
- if (mem_ctx == NULL) {
- DEBUG(0, ("out of memory for net_share_enum_rpc!\n"));
- cli_rpc_pipe_close(pipe_hnd);
- return -1;
- }
-
/* Issue the NetShareEnum RPC call and retrieve the response */
init_enum_hnd(&enum_hnd, 0);
result = rpccli_srvsvc_net_share_enum(pipe_hnd,
- mem_ctx,
+ talloc_tos(),
info_level,
&ctr,
preferred_len,
/* Close the server service pipe */
cli_rpc_pipe_close(pipe_hnd);
- /* Free all memory which was allocated for this request */
- TALLOC_FREE(mem_ctx);
-
/* Tell 'em if it worked */
return W_ERROR_IS_OK(result) ? 0 : -1;
}
SMBCFILE *dir = NULL;
struct _smbc_callbacks *cb;
struct sockaddr_storage rem_ss;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
DEBUG(4, ("no valid context\n"));
errno = EINVAL + 8192;
+ TALLOC_FREE(frame);
return NULL;
}
if (!fname) {
DEBUG(4, ("no valid fname\n"));
errno = EINVAL + 8193;
+ TALLOC_FREE(frame);
return NULL;
}
options, sizeof(options))) {
DEBUG(4, ("no valid path\n"));
errno = EINVAL + 8194;
+ TALLOC_FREE(frame);
return NULL;
}
if (smbc_check_options(server, share, path, options)) {
DEBUG(4, ("unacceptable options (%s)\n", options));
errno = EINVAL + 8195;
+ TALLOC_FREE(frame);
return NULL;
}
if (!dir) {
errno = ENOMEM;
+ TALLOC_FREE(frame);
return NULL;
}
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
}
+ TALLOC_FREE(frame);
return NULL;
}
SAFE_FREE(dir);
}
errno = ENOENT;
+ TALLOC_FREE(frame);
return NULL;
}
&server_addr, sizeof(server_addr));
if (ip_list == NULL) {
errno = ENOMEM;
+ TALLOC_FREE(frame);
return NULL;
}
count = 1;
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
}
+ TALLOC_FREE(frame);
return NULL;
}
SAFE_FREE(dir);
}
errno = EPERM;
+ TALLOC_FREE(frame);
return NULL;
}
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
}
+ TALLOC_FREE(frame);
return NULL;
}
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
}
+ TALLOC_FREE(frame);
return NULL;
}
} else if (srv ||
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
}
+ TALLOC_FREE(frame);
return NULL;
}
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
}
+ TALLOC_FREE(frame);
return NULL;
}
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
}
+ TALLOC_FREE(frame);
return NULL;
}
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
}
+ TALLOC_FREE(frame);
return NULL;
}
SAFE_FREE(dir->fname);
SAFE_FREE(dir);
}
+ TALLOC_FREE(frame);
return NULL;
}
}
errno = saved_errno;
+ TALLOC_FREE(frame);
return NULL;
}
}
}
DLIST_ADD(context->internal->_files, dir);
+ TALLOC_FREE(frame);
return dir;
}
smbc_closedir_ctx(SMBCCTX *context,
SMBCFILE *dir)
{
+ TALLOC_CTX *frame = talloc_tos();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!dir || !DLIST_CONTAINS(context->internal->_files, dir)) {
errno = EBADF;
+ TALLOC_FREE(frame);
return -1;
}
SAFE_FREE(dir); /* Free the space too */
}
+ TALLOC_FREE(frame);
return 0;
}
{
int maxlen;
struct smbc_dirent *dirp, *dirent;
+ TALLOC_CTX *frame = talloc_stackframe();
/* Check that all is ok first ... */
errno = EINVAL;
DEBUG(0, ("Invalid context in smbc_readdir_ctx()\n"));
+ TALLOC_FREE(frame);
return NULL;
}
errno = EBADF;
DEBUG(0, ("Invalid dir in smbc_readdir_ctx()\n"));
+ TALLOC_FREE(frame);
return NULL;
}
errno = ENOTDIR;
DEBUG(0, ("Found file vs directory in smbc_readdir_ctx()\n"));
+ TALLOC_FREE(frame);
return NULL;
}
if (!dir->dir_next) {
+ TALLOC_FREE(frame);
return NULL;
}
if (!dirent) {
errno = ENOENT;
+ TALLOC_FREE(frame);
return NULL;
}
dir->dir_next = dir->dir_next->next;
+ TALLOC_FREE(frame);
return dirp;
}
int maxlen;
char *ndir = (char *)dirp;
struct smbc_dir_list *dirlist;
+ TALLOC_CTX *frame = talloc_stackframe();
/* Check that all is ok first ... */
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!dir || !DLIST_CONTAINS(context->internal->_files, dir)) {
errno = EBADF;
+ TALLOC_FREE(frame);
return -1;
}
if (dir->file != False) { /* FIXME, should be dir, perhaps */
errno = ENOTDIR;
+ TALLOC_FREE(frame);
return -1;
}
if (!dirlist->dirent) {
errno = ENOENT; /* Bad error */
+ TALLOC_FREE(frame);
return -1;
}
if (rem < count) { /* We managed to copy something */
errno = 0;
+ TALLOC_FREE(frame);
return count - rem;
}
else { /* Nothing copied ... */
errno = EINVAL; /* Not enough space ... */
+ TALLOC_FREE(frame);
return -1;
}
dir->dir_next = dirlist = dirlist -> next;
}
+ TALLOC_FREE(frame);
+
if (rem == count)
return 0;
else
fstring workgroup;
pstring path, targetpath;
struct cli_state *targetcli;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!srv) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_server */
}
if (!cli_resolve_path( "", srv->cli, path, &targetcli, targetpath))
{
d_printf("Could not resolve %s\n", path);
+ TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>mkdir: resolved path as %s\n", targetpath);*/
if (!cli_mkdir(targetcli, targetpath)) {
errno = smbc_errno(context, targetcli);
+ TALLOC_FREE(frame);
return -1;
}
+ TALLOC_FREE(frame);
return 0;
}
pstring path;
pstring targetpath;
struct cli_state *targetcli;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
NULL, 0))
{
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!srv) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_server */
}
if (!cli_resolve_path( "", srv->cli, path, &targetcli, targetpath))
{
d_printf("Could not resolve %s\n", path);
+ TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>rmdir: resolved path as %s\n", targetpath);*/
}
+ TALLOC_FREE(frame);
return -1;
}
+ TALLOC_FREE(frame);
return 0;
}
smbc_telldir_ctx(SMBCCTX *context,
SMBCFILE *dir)
{
+ TALLOC_CTX *frame = talloc_stackframe();
+
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!dir || !DLIST_CONTAINS(context->internal->_files, dir)) {
errno = EBADF;
+ TALLOC_FREE(frame);
return -1;
}
if (dir->file != False) { /* FIXME, should be dir, perhaps */
errno = ENOTDIR;
+ TALLOC_FREE(frame);
return -1;
}
/* See if we're already at the end. */
if (dir->dir_next == NULL) {
/* We are. */
+ TALLOC_FREE(frame);
return -1;
}
/*
* We return the pointer here as the offset
*/
+ TALLOC_FREE(frame);
return (off_t)(long)dir->dir_next->dirent;
}
long int l_offset = offset; /* Handle problems of size */
struct smbc_dirent *dirent = (struct smbc_dirent *)l_offset;
struct smbc_dir_list *list_ent = (struct smbc_dir_list *)NULL;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (dir->file != False) { /* FIXME, should be dir, perhaps */
errno = ENOTDIR;
+ TALLOC_FREE(frame);
return -1;
}
if (dirent == NULL) { /* Seek to the begining of the list */
dir->dir_next = dir->dir_list;
+ TALLOC_FREE(frame);
return 0;
}
if (offset == -1) { /* Seek to the end of the list */
dir->dir_next = NULL;
+ TALLOC_FREE(frame);
return 0;
}
if ((list_ent = smbc_check_dir_ent(dir->dir_list, dirent)) == NULL) {
errno = EINVAL; /* Bad entry */
+ TALLOC_FREE(frame);
return -1;
}
dir->dir_next = list_ent;
+ TALLOC_FREE(frame);
return 0;
}
fstring workgroup;
pstring path;
uint16 mode;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL; /* Best I can think of ... */
+ TALLOC_FREE(frame);
return -1;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
server, share, workgroup, user, password);
if (!srv) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_server */
}
if (!cli_setatr(srv->cli, path, mode, 0)) {
errno = smbc_errno(context, srv->cli);
+ TALLOC_FREE(frame);
return -1;
}
+ TALLOC_FREE(frame);
return 0;
}
pstring path;
time_t access_time;
time_t write_time;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL; /* Best I can think of ... */
+ TALLOC_FREE(frame);
return -1;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
server, share, workgroup, user, password);
if (!srv) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_server */
}
if (!smbc_setatr(context, srv, path,
0, access_time, write_time, 0, 0)) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_setatr */
}
+ TALLOC_FREE(frame);
return 0;
}
fstring password;
fstring workgroup;
pstring path;
- TALLOC_CTX *ctx;
POLICY_HND pol;
DOS_ATTR_DESC *dad;
struct {
const char * write_time_attr;
const char * change_time_attr;
} attr_strings;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL; /* Best I can think of ... */
+ TALLOC_FREE(frame);
return -1;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
srv = smbc_server(context, True,
server, share, workgroup, user, password);
if (!srv) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_server */
}
ipc_srv = NULL;
}
- ctx = talloc_init("smbc_setxattr");
- if (!ctx) {
- errno = ENOMEM;
- return -1;
- }
-
/*
* Are they asking to set the entire set of known attributes?
*/
StrCaseCmp(name, "system.*+") == 0) {
/* Yup. */
char *namevalue =
- talloc_asprintf(ctx, "%s:%s",
+ talloc_asprintf(talloc_tos(), "%s:%s",
name+7, (const char *) value);
if (! namevalue) {
errno = ENOMEM;
ret = -1;
+ TALLOC_FREE(frame);
return -1;
}
if (ipc_srv) {
- ret = cacl_set(ctx, srv->cli,
+ ret = cacl_set(talloc_tos(), srv->cli,
ipc_srv->cli, &pol, path,
namevalue,
(*namevalue == '*'
}
/* get a DOS Attribute Descriptor with current attributes */
- dad = dos_attr_query(context, ctx, path, srv);
+ dad = dos_attr_query(context, talloc_tos(), path, srv);
if (dad) {
/* Overwrite old with new, using what was provided */
dos_attr_parse(context, dad, srv, namevalue);
ret = 0;
}
- talloc_destroy(ctx);
+ TALLOC_FREE(frame);
return ret;
}
/* Yup. */
char *namevalue =
- talloc_asprintf(ctx, "%s:%s",
+ talloc_asprintf(talloc_tos(), "%s:%s",
name+19, (const char *) value);
if (! ipc_srv) {
errno = ENOMEM;
ret = -1;
} else {
- ret = cacl_set(ctx, srv->cli,
+ ret = cacl_set(talloc_tos(), srv->cli,
ipc_srv->cli, &pol, path,
namevalue,
(*namevalue == '*'
: SMBC_XATTR_MODE_ADD),
flags);
}
- talloc_destroy(ctx);
+ TALLOC_FREE(frame);
return ret;
}
/* Yup. */
char *namevalue =
- talloc_asprintf(ctx, "%s:%s",
+ talloc_asprintf(talloc_tos(), "%s:%s",
name+19, (const char *) value);
if (! ipc_srv) {
errno = ENOMEM;
ret = -1;
} else {
- ret = cacl_set(ctx, srv->cli,
+ ret = cacl_set(talloc_tos(), srv->cli,
ipc_srv->cli, &pol, path,
namevalue, SMBC_XATTR_MODE_CHOWN, 0);
}
- talloc_destroy(ctx);
+ TALLOC_FREE(frame);
return ret;
}
/* Yup. */
char *namevalue =
- talloc_asprintf(ctx, "%s:%s",
+ talloc_asprintf(talloc_tos(), "%s:%s",
name+19, (const char *) value);
if (! ipc_srv) {
errno = ENOMEM;
ret = -1;
} else {
- ret = cacl_set(ctx, srv->cli,
+ ret = cacl_set(talloc_tos(), srv->cli,
ipc_srv->cli, &pol, path,
namevalue, SMBC_XATTR_MODE_CHOWN, 0);
}
- talloc_destroy(ctx);
+ TALLOC_FREE(frame);
return ret;
}
StrCaseCmp(name, attr_strings.change_time_attr) == 0) {
/* get a DOS Attribute Descriptor with current attributes */
- dad = dos_attr_query(context, ctx, path, srv);
+ dad = dos_attr_query(context, talloc_tos(), path, srv);
if (dad) {
char *namevalue =
- talloc_asprintf(ctx, "%s:%s",
+ talloc_asprintf(talloc_tos(), "%s:%s",
name+16, (const char *) value);
if (! namevalue) {
errno = ENOMEM;
ret = -1;
}
- talloc_destroy(ctx);
+ TALLOC_FREE(frame);
return ret;
}
/* Unsupported attribute name */
- talloc_destroy(ctx);
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
fstring password;
fstring workgroup;
pstring path;
- TALLOC_CTX *ctx;
POLICY_HND pol;
struct {
const char * create_time_attr;
const char * write_time_attr;
const char * change_time_attr;
} attr_strings;
-
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL; /* Best I can think of ... */
+ TALLOC_FREE(frame);
return -1;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
srv = smbc_server(context, True,
server, share, workgroup, user, password);
if (!srv) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_server */
}
ipc_srv = NULL;
}
- ctx = talloc_init("smbc:getxattr");
- if (!ctx) {
- errno = ENOMEM;
- return -1;
- }
-
/* Determine whether to use old-style or new-style attribute names */
if (context->internal->_full_time_names) {
/* new-style names */
StrCaseCmp(name, "system.dos_attr.inode") == 0) {
/* Yup. */
- ret = cacl_get(context, ctx, srv,
+ ret = cacl_get(context, talloc_tos(), srv,
ipc_srv == NULL ? NULL : ipc_srv->cli,
&pol, path,
CONST_DISCARD(char *, name),
if (ret < 0 && errno == 0) {
errno = smbc_errno(context, srv->cli);
}
- talloc_destroy(ctx);
+ TALLOC_FREE(frame);
return ret;
}
/* Unsupported attribute name */
- talloc_destroy(ctx);
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
fstring password;
fstring workgroup;
pstring path;
- TALLOC_CTX *ctx;
POLICY_HND pol;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL; /* Best I can think of ... */
+ TALLOC_FREE(frame);
return -1;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
srv = smbc_server(context, True,
server, share, workgroup, user, password);
if (!srv) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_server */
}
}
if (! ipc_srv) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_attr_server */
}
- ctx = talloc_init("smbc_removexattr");
- if (!ctx) {
- errno = ENOMEM;
- return -1;
- }
-
/* Are they asking to set the entire ACL? */
if (StrCaseCmp(name, "system.nt_sec_desc.*") == 0 ||
StrCaseCmp(name, "system.nt_sec_desc.*+") == 0) {
/* Yup. */
- ret = cacl_set(ctx, srv->cli,
+ ret = cacl_set(talloc_tos(), srv->cli,
ipc_srv->cli, &pol, path,
NULL, SMBC_XATTR_MODE_REMOVE_ALL, 0);
- talloc_destroy(ctx);
+ TALLOC_FREE(frame);
return ret;
}
StrnCaseCmp(name, "system.nt_sec_desc.acl+", 23) == 0) {
/* Yup. */
- ret = cacl_set(ctx, srv->cli,
+ ret = cacl_set(talloc_tos(), srv->cli,
ipc_srv->cli, &pol, path,
name + 19, SMBC_XATTR_MODE_REMOVE, 0);
- talloc_destroy(ctx);
+ TALLOC_FREE(frame);
return ret;
}
/* Unsupported attribute name */
- talloc_destroy(ctx);
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
fstring user;
fstring password;
pstring path;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return NULL;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return NULL;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return NULL;
}
/* What if the path is empty, or the file exists? */
+ TALLOC_FREE(frame);
return (context->open)(context, fname, O_WRONLY, 666);
}
int saverr;
int tot_bytes = 0;
char buf[4096];
+ TALLOC_CTX *frame = talloc_stackframe();
if (!c_file || !c_file->internal->_initialized || !c_print ||
!c_print->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!fname && !printq) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if ((long)(fid1 = (c_file->open)(c_file, fname, O_RDONLY, 0666)) < 0) {
DEBUG(3, ("Error, fname=%s, errno=%i\n", fname, errno));
+ TALLOC_FREE(frame);
return -1; /* smbc_open sets errno */
}
saverr = errno; /* Save errno */
(c_file->close_fn)(c_file, fid1);
errno = saverr;
+ TALLOC_FREE(frame);
return -1;
}
if (bytes < 0) {
errno = saverr;
+ TALLOC_FREE(frame);
return -1;
}
+ TALLOC_FREE(frame);
return tot_bytes;
}
fstring password;
fstring workgroup;
pstring path;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!srv) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_server */
}
(void (*)(struct print_job_info *))fn) < 0) {
errno = smbc_errno(context, srv->cli);
+ TALLOC_FREE(frame);
return -1;
}
+ TALLOC_FREE(frame);
return 0;
}
fstring workgroup;
pstring path;
int err;
+ TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal ||
!context->internal->_initialized) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!fname) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
password, sizeof(password),
NULL, 0)) {
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
if (!srv) {
+ TALLOC_FREE(frame);
return -1; /* errno set by smbc_server */
}
errno = smbc_errno(context, srv->cli);
else if (err == ERRnosuchprintjob)
errno = EINVAL;
+ TALLOC_FREE(frame);
return -1;
}
+ TALLOC_FREE(frame);
return 0;
}