Ejemplo n.º 1
0
void vfs_init(unsigned int drive,unsigned int addr){
	unsigned char sector[513];
	kprintf("reading drive=%d at addr=%x\n",drive,addr);
	read_sector_lba28(drive, addr, 1,0, &sector);
	unsigned int fsID1 = sector[0x01BE + 0x04];
	unsigned int fsID2 = sector[0x01CE + 0x04];
	unsigned int fsID3 = sector[0x01DE + 0x04];
	unsigned int fsID4 = sector[0x01EE + 0x04];
	
	unsigned int boot1 = sector[0x01BE];
	unsigned int boot2 = sector[0x01CE];
	unsigned int boot3 = sector[0x01DE];
	unsigned int boot4 = sector[0x01EE];
	
	unsigned int offset1 = hex2dec(sector[0x01BE + 0x08]*1000+sector[0x01BE + 0x09]*100+sector[0x01BE + 0x10]*10);
	unsigned int offset2 = sector[0x01CE + 0x08];
	unsigned int offset3 = sector[0x01DE + 0x08];
	unsigned int offset4 = sector[0x01EE + 0x08];
	
	if (boot1==0x80)
		vfs_init_fs(1,fsID1,drive,addr,offset1);
/*	if (boot2==0x80)
		vfs_init_fs(2,sysID2,drive,addr,offset2);
	if (boot3==0x80)
		vfs_init_fs(3,sysID3,drive,addr,offset3);
	if (boot4==0x80)
		vfs_init_fs(4,sysID4,drive,addr,offset4);*/
}
Ejemplo n.º 2
0
static uint32 _srv_SMBtcon_NT1(PSESS_HND sess_hnd, uint16 *conn_tid,
				Q_TCON_ANDX_4 *q4,
				Q_TCON_ANDX_D_4 *qd4,
				R_TCON_ANDX_3 *r3,
				R_TCON_ANDX_D_3 *rd3)
{
	PCONN_HND conn_hnd = NULL;
	int snum = -1;
	SMBSTR *dir_path = NULL;
	const char *path = smbstrA(&qd4->path);
	const char *dev = smbstrA(&qd4->device);
	char *service;
	struct vfs_connection_struct *vfs_conn;
	struct smb_connection_struct *conn;
	BOOL is_ipc;
	BOOL is_print;
	uint32 err = NT_STATUS_NOPROBLEMO;

	conn_hnd = find_conn_hnd_by_index(sess_hnd, *conn_tid);
	if (conn_hnd != NULL)
	{
		DEBUG(10,("close connection %d\n", *conn_tid));
		conn_close_hnd(conn_hnd); 
	}

	if (path == NULL || dev == NULL)
		return ERRDOS|ERRnosuchshare;

	DEBUG(10,("path: [%s] device: [%s]\n", path, dev));

	service = strchr(path+2, '\\') + 1;

	snum = lp_servicenumber(service);
	if (snum < 0)
	{
		err = ERRDOS|ERRnosuchshare;
		goto end;
	}

	if (!create_conn_hnd(sess_hnd, &conn_hnd, NULL) ||
	    conn_hnd == NULL ||
	    !get_conn_index(conn_hnd, conn_tid))
	{
		err = NT_STATUS_INVALID_HANDLE;
		goto end;
	}

	is_ipc = strequal(dev, "IPC") || strequal(service, "IPC$");
	is_print = strequal(dev, "LPT:");

	vfs_conn = g_new(struct vfs_connection_struct, 1);
	if (vfs_conn == NULL)
	{
		err = NT_STATUS_NO_MEMORY;
		goto end;
	}

	conn = g_new(struct smb_connection_struct, 1);
	if (conn == NULL)
	{
		err = NT_STATUS_NO_MEMORY;
		goto end;
	}

	if (is_ipc)
	{
		rd3->service = "IPC";
		smbstr_initA(&rd3->nativefs, "", 0);
		dir_path = NULL;
		vfs_init_ipc(vfs_conn, snum);
		smbvfs_init_ipc(conn, snum);
	}
	else if (is_print)
	{
		rd3->service = "LPT:";
		smbstr_initA(&rd3->nativefs, "", 0);
		dir_path = smbstr_setA("", 0);
		vfs_init_print(vfs_conn, snum);
		smbvfs_init_print(conn, snum);
	}
	else
	{
		rd3->service = "A:";
		smbstr_initA(&rd3->nativefs, lp_fstype(snum), 0);
		dir_path = smbstr_setA(lp_pathname(snum), 0);
		vfs_init_fs(vfs_conn, snum);
		smbvfs_init_fs(conn, snum);
	}

	vfs_conn->connectpath = smbstr_dup(dir_path);

	if (!set_conn_info(conn_hnd, vfs_conn, conn,
				smbstr_dup(&qd4->path), dir_path))
	{
		err = NT_STATUS_INVALID_HANDLE;
		goto end;
	}

	DEBUG(10,("service: [%s] snum: [%d] tid: [%d]\n",
				dir_path ? smbstrA(dir_path) : "",
				snum, *conn_tid));

end:
	if (err)
	{
		DEBUG(10,("error:[%x]\n", err));
		conn_close_hnd(conn_hnd);
	}
	return err;
}