/* * ncptest.c * * Copyright (C) 1995 by Volker Lendecke * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* #include */ /* generates a warning here */ extern pid_t waitpid(pid_t, int *, int); #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ncplib.h" void test_connlist(struct ncp_conn *conn) { __u8 conn_list[256] = {0,}; int no; ncp_get_connlist(conn, NCP_BINDERY_USER, "SUPERVISOR", &no, conn_list); return; } void test_send(struct ncp_conn *conn) { __u8 conn_list[256] = {0,}; int no; if (ncp_get_connlist(conn, NCP_BINDERY_USER, "ME", &no, conn_list) != 0) { no = 0; } if (no > 0) { ncp_send_broadcast(conn, no, conn_list, "Hallo"); } return; } void test_create(struct ncp_conn *conn) { struct nw_info_struct sys; struct nw_info_struct me; __u8 dir_handle; struct ncp_file_info new_file; if (ncp_do_lookup(conn, NULL, "SYS", &sys) != 0) { printf("lookup error\n"); return; } if (ncp_do_lookup(conn, &sys, "ME", &me) != 0) { printf("lookup public error\n"); return; } if (ncp_alloc_short_dir_handle(conn, &me, NCP_ALLOC_TEMPORARY, &dir_handle) != 0) { printf("alloc_dir_handle error\n"); return; } if (ncp_create_file(conn, dir_handle, "BLUB.TXT", 0, &new_file) != 0) { printf("create error\n"); return; } if (ncp_dealloc_dir_handle(conn, dir_handle) != 0) { printf("dealloc error\n"); return; } } int test_change(struct ncp_conn *conn) { long result; unsigned char ncp_key[8]; struct ncp_bindery_object user; if ((result = ncp_get_encryption_key(conn, ncp_key)) != 0) { return result; } if ((result = ncp_get_bindery_object_id(conn, 1, "ME", &user)) != 0) { return result; } if ((result = ncp_change_login_passwd(conn, &user, ncp_key, "MEE", "ME")) != 0) { return result; } return 0; } int main(int argc, char *argv[]) { struct ncp_conn *conn; long err; if ((conn = ncp_initialize(&argc, argv, 1, &err)) == NULL) { com_err(argv[0], err, "in ncp_initialize"); return 1; } test_change(conn); ncp_close(conn); return 0; }