/* Create listener */
SilcNetListener silc_local_net_create_listener(const char *filepath,
+ SilcLocalNetSecurity security,
SilcSchedule schedule,
SilcNetCallback callback,
void *context)
SilcUInt16 *local_port;
const char *addr = "127.0.0.1";
char port[8];
+ int mode = 0;
SILC_LOG_DEBUG(("Creating local network stream listener %s", filepath));
return NULL;
}
+ /* Set mode */
+ if (!security)
+ mode = 0644;
+ if (security & SILC_LOCAL_NET_USER)
+ mode = 0600;
+ if (security & SILC_LOCAL_NET_GROUP)
+ mode += 040;
+
/* Create the file */
silc_snprintf(port, sizeof(port), "%d", *local_port);
- if (silc_file_writefile(filepath, port, strlen(port) + 1)) {
+ if (silc_file_writefile_mode(filepath, port, strlen(port) + 1, mode)) {
silc_free(local_port);
silc_net_close_listener(listener->listener);
silc_free(listener);
unlink(listener->filepath);
silc_net_close_listener(listener->listener);
+ silc_free(listener->filepath);
silc_free(listener);
}