mirror of
https://github.com/mabam/afpfs-ng-mac.git
synced 2024-12-28 06:30:24 +00:00
use anonymous UAM if no user/password provided in connection request
This commit is contained in:
parent
2017974c85
commit
2f232087da
@ -215,11 +215,14 @@ static int server_subconnect(void)
|
||||
|
||||
#define BUFFER_SIZE 2048
|
||||
conn_req = malloc(sizeof(struct afp_connection_request));
|
||||
if(!conn_req)
|
||||
return -1;
|
||||
|
||||
memset(conn_req, 0,sizeof(struct afp_connection_request));
|
||||
memset(conn_req, 0,sizeof(struct afp_connection_request));
|
||||
|
||||
conn_req->url=url;
|
||||
conn_req->url=url;
|
||||
conn_req->url.requested_version=31;
|
||||
|
||||
if (strlen(url.uamname)>0) {
|
||||
if ((conn_req->uam_mask = find_uam_by_name(url.uamname))==0) {
|
||||
printf("I don't know about UAM %s\n",url.uamname);
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -7,7 +6,7 @@
|
||||
|
||||
void afp_default_url(struct afp_url *url)
|
||||
{
|
||||
memset(url,0,sizeof(*url));
|
||||
memset(url,0,sizeof(struct afp_url));
|
||||
url->protocol=TCPIP;
|
||||
url->port=548;
|
||||
}
|
||||
@ -294,7 +293,7 @@ int afp_parse_url(struct afp_url * url, const char * toparse, int verbose)
|
||||
snprintf(url->username,strlen(p)+1,"%s", p);
|
||||
if (check_username(url->username)) {
|
||||
if (verbose) printf("This isn't a valid username\n");
|
||||
return -1;;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,15 @@ struct afp_server * afp_server_full_connect (void * priv, struct afp_connection_
|
||||
goto error;
|
||||
}
|
||||
|
||||
//if our user and password strings are both empty and if
|
||||
//the server supports anonymous logins, pretend we only support
|
||||
//that as auth will never succeed with such credentials
|
||||
if(*req->url.username == '\0' && *req->url.password == '\0'
|
||||
&& (uams & UAM_NOUSERAUTHENT)) {
|
||||
req->uam_mask = UAM_NOUSERAUTHENT;
|
||||
}
|
||||
|
||||
|
||||
if ((afp_server_complete_connection(priv,
|
||||
s,address,(unsigned char *) &versions,uams,
|
||||
req->url.username, req->url.password,
|
||||
|
@ -64,6 +64,9 @@ int dsi_getstatus(struct afp_server * server)
|
||||
struct afp_rx_buffer rx;
|
||||
int ret;
|
||||
rx.data=malloc(GETSTATUS_BUF_SIZE);
|
||||
if(rx.data == NULL)
|
||||
return -1;
|
||||
|
||||
rx.maxsize=GETSTATUS_BUF_SIZE;
|
||||
rx.size=0;
|
||||
dsi_setup_header(server,&header,DSI_DSIGetStatus);
|
||||
@ -192,7 +195,7 @@ int dsi_send(struct afp_server *server, char * msg, int size,int wait,unsigned c
|
||||
afp_wait_for_started_loop();
|
||||
|
||||
/* Add request to the queue */
|
||||
if (!(new_request=malloc(sizeof(struct dsi_request)))) {
|
||||
if ((new_request=malloc(sizeof(struct dsi_request))) == NULL) {
|
||||
log_for_client(NULL,AFPFSD,LOG_ERR,
|
||||
"Could not allocate for new request\n");
|
||||
return -1;
|
||||
|
@ -581,7 +581,7 @@ int ll_getattr(struct afp_volume * volume, const char *path, struct stat *stbuf,
|
||||
if (volume->server->using_version->av_number>=30 && fp.unixprivs.permissions != 0)
|
||||
stbuf->st_mode |= fp.unixprivs.permissions;
|
||||
else
|
||||
set_nonunix_perms((mode_t *)&stbuf->st_mode,&fp);
|
||||
set_nonunix_perms((unsigned int *)&stbuf->st_mode,&fp);
|
||||
|
||||
stbuf->st_uid=fp.unixprivs.uid;
|
||||
stbuf->st_gid=fp.unixprivs.gid;
|
||||
|
Loading…
Reference in New Issue
Block a user