Network Block Device
@PACKAGE_VERSION@
|
#include "config.h"
#include "nbd-debug.h"
#include <nbdsrv.h>
#include <assert.h>
#include <ctype.h>
#include <netdb.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <cliserv.h>
Go to the source code of this file.
Macros | |
#define | LINELEN 256 |
Size of static buffer used to read the authorization file (yuck) More... | |
Functions | |
bool | address_matches (const char *mask, const struct sockaddr *addr, GError **err) |
Check whether a given address matches a given netmask. More... | |
uint8_t | getmaskbyte (int masklen) |
Gets a byte to allow for address masking. More... | |
int | authorized_client (CLIENT *opts) |
Check whether a client is allowed to connect. More... | |
SERVER * | dup_serve (const SERVER *const s) |
duplicate server More... | |
int | append_serve (const SERVER *const s, GArray *const a) |
append new server to array More... | |
uint64_t | size_autodetect (int fhandle) |
Detect the size of a file. More... | |
#define LINELEN 256 |
Size of static buffer used to read the authorization file (yuck)
Definition at line 19 of file nbdsrv.c.
Referenced by authorized_client().
bool address_matches | ( | const char * | mask, |
const struct sockaddr * | addr, | ||
GError ** | err | ||
) |
Check whether a given address matches a given netmask.
mask | the address or netmask to check against, in ASCII representation |
addr | the address to check |
Definition at line 25 of file nbdsrv.c.
Referenced by authorized_client().
int append_serve | ( | const SERVER *const | s, |
GArray *const | a | ||
) |
append new server to array
s | server |
a | server array |
Definition at line 192 of file nbdsrv.c.
Referenced by append_new_servers(), main(), and parse_cfile().
int authorized_client | ( | CLIENT * | opts | ) |
Check whether a client is allowed to connect.
Works with an authorization file which contains one line per machine or network, with CIDR-style netmasks.
opts | The client who's trying to connect. |
Definition at line 105 of file nbdsrv.c.
References address_matches(), SERVER::authname, CLIENT::clientaddr, dup_serve(), LINELEN, msg, and CLIENT::server.
Referenced by getmaskbyte(), handle_modern_connection(), and handle_oldstyle_connection().
duplicate server
s | the old server we want to duplicate |
Definition at line 149 of file nbdsrv.c.
Referenced by authorized_client().
uint8_t getmaskbyte | ( | int | masklen | ) |
Gets a byte to allow for address masking.
masklen | the length of the requested mask. |
Definition at line 93 of file nbdsrv.c.
References authorized_client().
Referenced by set_peername().
uint64_t size_autodetect | ( | int | fhandle | ) |
Detect the size of a file.
fhandle | An open filedescriptor |
Definition at line 252 of file nbdsrv.c.
Referenced by setupexport().