Ignore:
Timestamp:
Nov 12, 2012, 5:38:52 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server 3.5: update branche to 3.5.16

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.5.x/source3/smbd/notify.c

    r590 r736  
    367367}
    368368
     369static void notify_parent_dir(connection_struct *conn,
     370                                uint32 action, uint32 filter,
     371                                const char *path)
     372{
     373        struct smb_filename smb_fname_parent;
     374        char *parent;
     375        const char *name;
     376        char *oldwd;
     377
     378        if (!parent_dirname(talloc_tos(), path, &parent, &name)) {
     379                DEBUG(1, ("Can't get parent dirname, giving up\n"));
     380                return;
     381        }
     382
     383        ZERO_STRUCT(smb_fname_parent);
     384        smb_fname_parent.base_name = parent;
     385
     386        oldwd = vfs_GetWd(parent, conn);
     387        if (oldwd == NULL) {
     388                DEBUG(1, ("vfs_GetWd failed!\n"));
     389                goto done;
     390        }
     391        if (vfs_ChDir(conn, conn->connectpath) == -1) {
     392                DEBUG(1, ("Could not chdir to connect path!\n"));
     393                goto done;
     394        }
     395
     396        if (SMB_VFS_STAT(conn, &smb_fname_parent) == -1) {
     397                goto chdir_done;
     398        }
     399
     400        notify_onelevel(conn->notify_ctx, action, filter,
     401                        SMB_VFS_FILE_ID_CREATE(conn, &smb_fname_parent.st),
     402                        name);
     403chdir_done:
     404        vfs_ChDir(conn, oldwd);
     405done:
     406        TALLOC_FREE(parent);
     407}
     408
    369409void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
    370410                  const char *path)
    371411{
    372         char *fullpath;
    373         char *parent;
    374         const char *name;
     412        char *fullpath = NULL;
    375413
    376414        if (path[0] == '.' && path[1] == '/') {
    377415                path += 2;
    378416        }
    379         if (parent_dirname(talloc_tos(), path, &parent, &name)) {
    380                 struct smb_filename smb_fname_parent;
    381 
    382                 ZERO_STRUCT(smb_fname_parent);
    383                 smb_fname_parent.base_name = parent;
    384 
    385                 if (SMB_VFS_STAT(conn, &smb_fname_parent) != -1) {
    386                         notify_onelevel(conn->notify_ctx, action, filter,
    387                             SMB_VFS_FILE_ID_CREATE(conn, &smb_fname_parent.st),
    388                             name);
    389                 }
    390         }
     417        notify_parent_dir(conn, action, filter, path);
    391418
    392419        fullpath = talloc_asprintf(talloc_tos(), "%s/%s", conn->connectpath,
Note: See TracChangeset for help on using the changeset viewer.