Esempio n. 1
0
/* -------------------------------- */
STATIC void test404()
{
u_int16_t vol = VolID;
DSI *dsi = &Conn->dsi;
u_int16_t ret;

	enter_test();
    fprintf(stdout,"===================\n");
    fprintf(stdout,"FPOpenVol:t404: lazy init of dbd cnid\n");

    FAIL (FPCloseVol(Conn, vol));

	ret = FPGetSrvrParms(Conn);
	if (ret) {
		failed();
		goto fin;
	}

	/* --------- */
    ret = FPOpenVolFull(Conn, Vol, 1<<VOLPBIT_VID);
	if (ret == 0xffff) {
		failed();
		goto fin;
	}
	FAIL(FPGetFileDirParams(Conn, vol, DIRDID_ROOT, "", 0, 1 << DIRPBIT_ACCESS));

	/* --------- */
    FAIL (FPCloseVol(Conn, ret));
fin:
	ret = VolID = FPOpenVol(Conn, Vol);
	if (ret == 0xffff) {
		failed();
	}
	exit_test("test404");
}
Esempio n. 2
0
STATIC void test37()
{
unsigned int i;
int ofs;
u_int16_t param = VolID;
char *name = "t37 dir";
int  dir;
int  did;
u_int16_t vol = VolID;
DSI *dsi;
unsigned int ret;
unsigned char cmd;

	dsi = &Conn->dsi;

	enter_test();
    fprintf(stdout,"===================\n");
    fprintf(stdout,"Errror:test37: no folder error ==> ERR_NOOBJ\n");

	dir  = FPCreateDir(Conn,vol, DIRDID_ROOT , name);
	if (!dir) {
		nottested();
		goto fin;
	}
	did  = dir +1;

	for (i = 0 ;i < sizeof(afp_cmd_with_vol_did1);i++) {
		memset(dsi->commands, 0, DSI_CMDSIZ);
		dsi->header.dsi_flags = DSIFL_REQUEST;     
		dsi->header.dsi_command = DSIFUNC_CMD;
		dsi->header.dsi_requestID = htons(dsi_clientID(dsi));

		ofs = 0;
		cmd = afp_cmd_with_vol_did1[i];
		dsi->commands[ofs++] = cmd;
		dsi->commands[ofs++] = 0;

		memcpy(dsi->commands +ofs, &param, sizeof(param));
		ofs += sizeof(param);

		memcpy(dsi->commands +ofs, &did, sizeof(did));  /* directory did */
		ofs += sizeof(did);
		
		dsi->datalen = ofs;
		dsi->header.dsi_len = htonl(dsi->datalen);
		dsi->header.dsi_code = 0; 
 
   		my_dsi_stream_send(dsi, dsi->commands, dsi->datalen);
		my_dsi_cmd_receive(dsi);
		ret = dsi->header.dsi_code;
    	if (ntohl(AFPERR_NOOBJ) != ret) {
			fprintf(stdout,"\tFAILED command %3i %s\t result %d %s\n", cmd, AfpNum2name(cmd),ntohl(ret), afp_error(ret));
			failed_nomsg();
    	}
    }
fin:
	FAIL (FPDelete(Conn, vol,  DIRDID_ROOT, name)) 
	exit_test("test37");
}
Esempio n. 3
0
int main()
{
	return_test();

	exit_test();
	
	return 0;
	
}
Esempio n. 4
0
/* ----------------------- */
STATIC void test209(void)
{
int ret;
	enter_test();
    fprintf(stdout,"===================\n");
    fprintf(stdout,"FPGetSrvrParms:test209: GetSrvrParms call\n");

	ret = FPGetSrvrParms(Conn);
	if (ret) {
		failed();
	}
	exit_test("test209");
	
}
Esempio n. 5
0
/* -------------------------- */
STATIC void test206()
{
u_int16_t bitmap;
u_int16_t vol = VolID;
struct afp_volume_parms parms;
DSI *dsi = &Conn->dsi;

	enter_test();
    fprintf(stdout,"===================\n");
	fprintf(stdout, "FPSetVolParms:test206: Set Volume parameters\n");
    bitmap = (1 << VOLPBIT_ATTR  )
	    |(1 << VOLPBIT_SIG   )
    	|(1 << VOLPBIT_CDATE )
	    |(1 << VOLPBIT_MDATE )
    	|(1 << VOLPBIT_BDATE )
	    |(1 << VOLPBIT_VID   )
    	|(1 << VOLPBIT_BFREE )
	    |(1 << VOLPBIT_BTOTAL)
    	|(1 << VOLPBIT_NAME);

 	FAIL (FPGetVolParam(Conn, vol, bitmap)) 
 	if (parms.bdate == parms.mdate) {
 		fprintf(stdout,"Backup and modification date are the same!\n");
 		nottested();
		goto test_exit;
 	}
	afp_volume_unpack(&parms, dsi->commands +sizeof( u_int16_t ), bitmap);
	bitmap = (1 << VOLPBIT_BDATE );
 	FAIL (htonl(AFPERR_PARAM) != FPSetVolParam(Conn, vol +1, bitmap, &parms)) 
 	FAIL (htonl(AFPERR_BITMAP) != FPSetVolParam(Conn, vol , 0xffff, &parms))
 	parms.bdate = parms.mdate;
 	FAIL (FPSetVolParam(Conn, vol, bitmap, &parms)) 
 	parms.bdate = 0;
	bitmap = (1 << VOLPBIT_BDATE )|(1 << VOLPBIT_MDATE );
 	FAIL (FPGetVolParam(Conn, vol, bitmap)) 
	afp_volume_unpack(&parms, dsi->commands +sizeof( u_int16_t ), bitmap);
 	if (parms.bdate != parms.mdate) {
 		fprintf(stdout,"\tFAILED Backup %x and modification %x date are not the same!\n",parms.bdate, parms.mdate );
 		failed_nomsg();
 	}
 	
test_exit:
	exit_test("test206");
} 	
Esempio n. 6
0
STATIC void test35()
{
unsigned int i;
int ofs;
u_int16_t param = VolID+1;
DSI *dsi;
unsigned int ret;
unsigned char cmd;

	dsi = &Conn->dsi;

	enter_test();
    fprintf(stdout,"===================\n");
    fprintf(stdout,"Error:test35: illegal volume (-5019 AFP_ERRPARAM)\n");

	for (i = 0 ;i < sizeof(afp_cmd_with_vol);i++) {
		memset(dsi->commands, 0, DSI_CMDSIZ);
		dsi->header.dsi_flags = DSIFL_REQUEST;     
		dsi->header.dsi_command = DSIFUNC_CMD;
		dsi->header.dsi_requestID = htons(dsi_clientID(dsi));

		ofs = 0;
		cmd = afp_cmd_with_vol[i];
		dsi->commands[ofs++] = cmd;
		dsi->commands[ofs++] = 0;

		memcpy(dsi->commands +ofs, &param, sizeof(param));
		ofs += sizeof(param);
		
		dsi->datalen = ofs;
		dsi->header.dsi_len = htonl(dsi->datalen);
		dsi->header.dsi_code = 0; 
 
   		my_dsi_stream_send(dsi, dsi->commands, dsi->datalen);
		my_dsi_cmd_receive(dsi);
		ret = dsi->header.dsi_code;
		
    	if (ntohl(AFPERR_PARAM) != ret) {
			fprintf(stdout,"\tFAILED command %3i %s\t result %d %s\n", cmd, AfpNum2name(cmd),ntohl(ret), afp_error(ret));
			failed_nomsg();
    	}
    }
	exit_test("test35");
}
Esempio n. 7
0
/* ----------------------- */
STATIC void test316(void)
{
int ret;
DSI *dsi = &Conn->dsi;
int nbe,i;
int found = 0;
unsigned char len;
unsigned char *b;

	enter_test();
    fprintf(stdout,"===================\n");
    fprintf(stdout,"FPGetSrvrParms:test316: GetSrvrParms for a volume with option nostat set\n");

	FPCloseVol(Conn,VolID);

	ret = FPGetSrvrParms(Conn);
	if (ret) {
		failed();
	}
	nbe = *(dsi->data +4);
	b = dsi->data+5;
	for (i = 0; i < nbe; i++) {
	    b++; /* flags */
	    len = *b;
	    b++;
	    if (!memcmp(b, Vol, len))
	        found = 1;
	    b += len;
	}
	if (!found) {
		failed();
	}

	VolID = FPOpenVol(Conn, Vol);
	if (VolID == 0xffff) {
		nottested();
	}
	exit_test("test316");
}
Esempio n. 8
0
/* ----------- */
STATIC void test204()
{
u_int16_t vol = VolID;
int ret;

	enter_test();
    fprintf(stdout,"===================\n");
    fprintf(stdout,"FPCloseVol:test204: Close Volume call\n");

	FAIL (FPCloseVol(Conn,vol))
	/* double close */
	ret = FPCloseVol(Conn, vol);
	if (not_valid_bitmap(ret, BITERR_ACCESS | BITERR_PARAM, AFPERR_PARAM)) {
		failed();
	}
	FAIL (htonl(AFPERR_PARAM) != FPCloseVol(Conn, vol +1))
	
	vol = VolID = FPOpenVol(Conn, Vol);
	if (vol == 0xffff) {
		failed();
	}
	exit_test("test204");

}
Esempio n. 9
0
/* ------------------------- */
STATIC void test205()
{
u_int16_t vol = VolID;
DSI *dsi = &Conn->dsi;
u_int16_t ret;
char *tp;

	enter_test();
    fprintf(stdout,"===================\n");
    fprintf(stdout,"FPOpenVol:t205: Open Volume call\n");

    FAIL (FPCloseVol(Conn, vol));
	/* --------- */
    ret = FPOpenVolFull(Conn, Vol, 0);
    if (ret != 0xffff || dsi->header.dsi_code != htonl(AFPERR_BITMAP)) {
		failed();    
    }
	
	if (ret != 0xffff) {
    	FAIL (FPCloseVol(Conn, ret));
	}
	/* --------- */
    ret = FPOpenVolFull(Conn, Vol, 0xffff);
    if (ret != 0xffff || dsi->header.dsi_code != htonl(AFPERR_BITMAP)) {
		failed();    
    }
	if (ret != 0xffff) {
    	FAIL (FPCloseVol(Conn, ret));
	}
	/* --------- */
	tp = strdup(Vol);
	if (!tp) {
		goto fin;
	}
	*tp = *tp +1;
    ret = FPOpenVol(Conn, tp);
	free(tp);
    if (ret != 0xffff || dsi->header.dsi_code != htonl(AFPERR_NOOBJ)) {
		failed();    
    }
	if (ret != 0xffff) {
    	FAIL (FPCloseVol(Conn, ret));
	}
	/* -------------- */
	ret = FPOpenVol(Conn, Vol);
	if (ret == 0xffff) {
		failed();
	}
	vol = FPOpenVol(Conn, Vol);
	if (vol != ret) {
		fprintf(stdout,"\tFAILED double open != volume id\n");
		failed_nomsg();
	}	
    FAIL (FPCloseVol(Conn, ret));
    FAIL (!FPCloseVol(Conn, ret));
fin:
	ret = VolID = FPOpenVol(Conn, Vol);
	if (ret == 0xffff) {
		failed();
	}
	exit_test("test205");
}