static bool canonicalize_connect_path(connection_struct *conn) { #ifdef REALPATH_TAKES_NULL bool ret; char *resolved_name = SMB_VFS_REALPATH(conn,conn->connectpath,NULL); if (!resolved_name) { return false; } ret = set_conn_connectpath(conn,resolved_name); SAFE_FREE(resolved_name); return ret; #else char resolved_name_buf[PATH_MAX+1]; char *resolved_name = SMB_VFS_REALPATH(conn,conn->connectpath,resolved_name_buf); if (!resolved_name) { return false; } return set_conn_connectpath(conn,resolved_name); #endif /* REALPATH_TAKES_NULL */ }
static bool canonicalize_connect_path(connection_struct *conn) { bool ret; char *resolved_name = SMB_VFS_REALPATH(conn,conn->connectpath); if (!resolved_name) { return false; } ret = set_conn_connectpath(conn,resolved_name); SAFE_FREE(resolved_name); return ret; }
static BOOL canonicalize_path(connection_struct *conn, pstring path) { #ifdef REALPATH_TAKES_NULL char *resolved_name = SMB_VFS_REALPATH(conn,path,NULL); if (!resolved_name) { return False; } pstrcpy(path, resolved_name); SAFE_FREE(resolved_name); return True; #else #ifdef PATH_MAX char resolved_name_buf[PATH_MAX+1]; #else pstring resolved_name_buf; #endif char *resolved_name = SMB_VFS_REALPATH(conn,path,resolved_name_buf); if (!resolved_name) { return False; } pstrcpy(path, resolved_name); return True; #endif /* REALPATH_TAKES_NULL */ }
static NTSTATUS cmd_realpath(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv) { char respath[PATH_MAX]; if (argc != 2) { printf("Usage: realpath <path>\n"); return NT_STATUS_OK; } if (SMB_VFS_REALPATH(vfs->conn, argv[1], respath) == NULL) { printf("realpath: error=%d (%s)\n", errno, strerror(errno)); return NT_STATUS_UNSUCCESSFUL; } printf("realpath: ok\n"); return NT_STATUS_OK; }