Exemple #1
0
WERROR _dfs_GetInfo(pipes_struct *p, NETDFS_Q_DFS_GETINFO *q_u, 
                     NETDFS_R_DFS_GETINFO *r_u)
{
	UNISTR2* uni_path = &q_u->path;
	uint32 level = q_u->level;
	int consumedcnt = sizeof(pstring);
	pstring path;
	BOOL ret = False;
	BOOL self_ref = False;
	struct junction_map jn;

	unistr2_to_ascii(path, uni_path, sizeof(path)-1);
	if(!create_junction(path, &jn))
		return WERR_DFS_NO_SUCH_SERVER;
  
	/* The following call can change the cwd. */
	if(!NT_STATUS_IS_OK(get_referred_path(p->mem_ctx, path, &jn, &consumedcnt, &self_ref)) || consumedcnt < strlen(path)) {
		vfs_ChDir(p->conn,p->conn->connectpath);
		return WERR_DFS_NO_SUCH_VOL;
	}

	vfs_ChDir(p->conn,p->conn->connectpath);
	r_u->info.switch_value = level;
	r_u->info.ptr0 = 1;
	r_u->status = WERR_OK;

	switch (level) {
		case 1: ret = init_reply_dfs_info_1(&jn, &r_u->info.u.info1); break;
		case 2: ret = init_reply_dfs_info_2(&jn, &r_u->info.u.info2); break;
		case 3: ret = init_reply_dfs_info_3(p->mem_ctx, &jn, &r_u->info.u.info3); break;
		case 100: ret = init_reply_dfs_info_100(&jn, &r_u->info.u.info100); break;
		default:
			r_u->info.ptr0 = 1;
			r_u->info.switch_value = 0;
			r_u->status = WERR_OK;
			ret = True;
			break;
	}

	if (!ret) 
		r_u->status = WERR_INVALID_PARAM;
  
	return r_u->status;
}
Exemple #2
0
WERROR _dfs_get_info(pipes_struct *p, DFS_Q_DFS_GET_INFO *q_u, 
                     DFS_R_DFS_GET_INFO *r_u)
{
  UNISTR2* uni_path = &q_u->uni_path;
  uint32 level = q_u->level;
  pstring path;
  struct junction_map jn;

  unistr2_to_dos(path, uni_path, sizeof(path)-1);
  if(!create_junction(path, &jn))
     return WERR_DFS_NO_SUCH_SERVER;
  
  if(!get_referred_path(path, &jn, NULL, NULL))
     return WERR_DFS_NO_SUCH_VOL;

  r_u->level = level;
  r_u->ptr_ctr = 1;
  r_u->status = init_reply_dfs_ctr(p->mem_ctx, level, &r_u->ctr, &jn, 1);
  
  return r_u->status;
}