Import ncpfs 0.23

This commit is contained in:
ncpfs archive import
2026-04-28 20:39:58 +02:00
parent 64f006632a
commit 84cb1f167d
10 changed files with 69 additions and 18 deletions

View File

@@ -255,6 +255,10 @@ ipx_sap_find_nearest(int server_type, struct sockaddr_ipx *result,
if(bind(sock,(struct sockaddr*)&addr,sizeof(addr))==-1)
{
if (errno == EADDRNOTAVAIL)
{
errno = NCPL_ET_NO_INTERFACE;
}
goto finished;
}
@@ -753,9 +757,10 @@ ncp_connect_any(struct ncp_conn *conn, int wdog_needed)
char name[NCP_BINDERY_NAME_LEN];
long result;
if (ipx_sap_find_nearest(IPX_SAP_FILE_SERVER, &addr, name) != 0)
if ((result = ipx_sap_find_nearest(IPX_SAP_FILE_SERVER,
&addr, name)) != 0)
{
return -1;
return result;
}
if ((result = ncp_connect_addr(conn, &addr, wdog_needed)) != 0)
@@ -1310,7 +1315,7 @@ ncp_fopen_nwc(const char *user, const char *mode)
struct ncp_conn_spec *
ncp_find_conn_spec(const char *server, const char *user, const char *password,
uid_t uid, long *err)
int login_necessary, uid_t uid, long *err)
{
static struct ncp_conn_spec spec;
@@ -1407,6 +1412,12 @@ ncp_find_conn_spec(const char *server, const char *user, const char *password,
}
}
if (login_necessary == 0)
{
memset(spec.user, 0, sizeof(spec.user));
memset(spec.password, 0, sizeof(spec.password));
}
if (strlen(spec.user) == 0)
{
return &spec;
@@ -1524,7 +1535,8 @@ ncp_initialize_as(int *argc, char **argv,
i += 1;
}
spec = ncp_find_conn_spec(server, user, password, getuid(), err);
spec = ncp_find_conn_spec(server, user, password, login_necessary,
getuid(), err);
if (spec == NULL)
{

View File

@@ -146,7 +146,7 @@ ncp_get_conn_ent(FILE *filep);
struct ncp_conn_spec *
ncp_find_conn_spec(const char *server, const char *user, const char *password,
uid_t uid, long *err);
int login_necessary, uid_t uid, long *err);
long
ncp_get_file_server_description_strings(struct ncp_conn *conn,

View File

@@ -24,4 +24,7 @@ ec NCPL_ET_INVALID_MODE,
ec NCPL_ET_LOGIN_FAILED,
"Login failed"
ec NCPL_ET_NO_INTERFACE,
"No primary IPX interface found"
end

View File

@@ -10,7 +10,7 @@
* a conditional which leaves out the test and load code.
*
* Even if we _do_ want ncpmount to load the module, passing a
* fully-qualified pathname to insmod causes it to bypass a
* fully-qualified pathname to modprobe causes it to bypass a
* path search. This may lead to ncpfs.o not being found on
* some systems.
*/
@@ -102,7 +102,7 @@ load_ncpfs(void)
else if (pid == 0)
{
/* child */
execl("/sbin/insmod", "insmod", "ncpfs", NULL);
execl("/sbin/modprobe", "modprobe", "ncpfs", NULL);
_exit(127); /* execl error */
}
else
@@ -321,7 +321,7 @@ main(int argc, char *argv[])
}
}
if ((spec = ncp_find_conn_spec(server, user, password, data.uid, &err))
if ((spec = ncp_find_conn_spec(server,user,password,1, data.uid, &err))
== NULL)
{
com_err(progname, err, "in find_conn_spec");

View File

@@ -32,6 +32,7 @@ main(int argc, char *argv[])
{
struct ncp_conn *conn;
char message[256];
char *mount_point;
struct ncp_fs_info info;
struct passwd *pwd;
char tty[256];
@@ -53,7 +54,8 @@ main(int argc, char *argv[])
exit(1);
}
if ((conn = ncp_open_mount(argv[1], &err)) == NULL)
mount_point = argv[1];
if ((conn = ncp_open_mount(mount_point, &err)) == NULL)
{
com_err(progname, err, "in ncp_open_mount");
exit(1);
@@ -104,7 +106,7 @@ main(int argc, char *argv[])
while ((mnt = getmntent(mtab)) != NULL)
{
if (strcmp(mnt->mnt_dir, conn->mount_point) == 0)
if (strcmp(mnt->mnt_dir, mount_point) == 0)
{
break;
}