Exemple #1
0
static int connect_volume(const char * volumename) 
{

	if (strlen(volumename)==0) goto error;

	/* Ah, we're not connected to a volume*/
	unsigned int len=0;
	char mesg[1024];

	if ((vol = find_volume_by_name(server,volumename))==NULL) 
	{
		printf("Could not find a volume called %s\n",volumename);
		goto error;
	}
	vol->mapping= AFP_MAPPING_LOGINIDS;
	vol->extra_flags |= VOLUME_EXTRA_FLAGS_NO_LOCKING;

	if (afp_connect_volume(vol,server,mesg,&len,1024 ))
	{
		printf("Could not access volume %s\n",
			vol->volume_name);
		goto error;
	}

	printf("Connected to volume %s\n",vol->volume_name_printable);

	return 0;
error:
	return -1;
}
Exemple #2
0
int afp_server_reconnect(struct afp_server * s, char * mesg,
	unsigned int *l, unsigned int max)
{
	int i;
	struct afp_volume * v;

        if (afp_server_connect(s,0))  {
		*l+=snprintf(mesg,max-*l,"Error resuming connection to %s\n",
			s->server_name_printable);
                return 1;
        }

        dsi_opensession(s);

	if(afp_server_login(s,mesg,l,max)) return 1;

         for (i=0;i<s->num_volumes;i++) {
                v=&s->volumes[i];
                if (strlen(v->mountpoint)) {
			if (afp_connect_volume(v,v->server,mesg,l,max))
				*l+=snprintf(mesg,max-*l,
                                        "Could not mount %s\n",
					v->volume_name_printable);
                }
        }

        return 0;
}
static int volopen(struct fuse_client * c, struct afp_volume * volume)
{
	char mesg[1024];
	unsigned int l = 0;	
	memset(mesg,0,1024);
	int rc=afp_connect_volume(volume,volume->server,mesg,&l,1024);

	log_for_client((void *) c,AFPFSD,LOG_ERR,mesg);

	return rc;

}