|
libdsm
0.0.4-11-g223c1ba
Minimalist and read-only SMB client lib
|
Functions to connect and authenticate to an SMB server. More...
Functions | |
| smb_session * | smb_session_new () |
| Allocates a new Session object. More... | |
| void | smb_session_destroy (smb_session *s) |
| Close a session and deallocate its ressources. More... | |
| int | smb_session_state (smb_session *s) |
| Returns the current state of the session. More... | |
| void | smb_session_set_creds (smb_session *s, const char *domain, const char *login, const char *password) |
| Set the credentials for this session. More... | |
| int | smb_session_connect (smb_session *s, const char *hostname, uint32_t ip, int transport) |
| Establish a connection and negotiate a session protocol with a remote host. More... | |
| int | smb_session_login (smb_session *s) |
| Authenticate on the remote host with the provided credentials. More... | |
| int | smb_session_is_guest (smb_session *s) |
| Am i logged in as Guest ? More... | |
| const char * | smb_session_server_name (smb_session *s) |
| Returns the server name with the <XX> type. More... | |
| int | smb_session_supports (smb_session *s, int what) |
| Check if a feature is supported/has been negociated with the server. More... | |
Functions to connect and authenticate to an SMB server.
| int smb_session_connect | ( | smb_session * | s, |
| const char * | hostname, | ||
| uint32_t | ip, | ||
| int | transport | ||
| ) |
Establish a connection and negotiate a session protocol with a remote host.
You have to provide both the ip and the name. This is a constraint of Netbios, which requires you to know its name before he accepts to speak with you.
| s | A session object. |
| hostname | The ASCII netbios name, the name type will be coerced to <20> since libdsm is about reading files |
| ip | The ip of the machine to connect to (in network byte order) |
| transport | The type of transport used, it could be SMB_TRANSPORT_TCP or SMB_TRANSPORT_NBT (Netbios over TCP, ie legacy) |
| void smb_session_destroy | ( | smb_session * | s | ) |
| int smb_session_is_guest | ( | smb_session * | s | ) |
Am i logged in as Guest ?
| s | The session object |
| int smb_session_login | ( | smb_session * | s | ) |
Authenticate on the remote host with the provided credentials.
Can be called if session state is SMB_STATE_DIALECT_OK. If successfull, session state transition to SMB_STATE_SESSION_OK Provides the credentials with smb_session_set_creds.
| s | The session object. |
| smb_session* smb_session_new | ( | ) |
Allocates a new Session object.
To be able to perform actions on shares and file, you'll need to call smb_session_connect, then authenticate with smb_authenticate.
| const char* smb_session_server_name | ( | smb_session * | s | ) |
Returns the server name with the <XX> type.
| s | The session object |
| void smb_session_set_creds | ( | smb_session * | s, |
| const char * | domain, | ||
| const char * | login, | ||
| const char * | password | ||
| ) |
Set the credentials for this session.
Any of the params except s can be NULL.
| s | The session object. |
| domain | Domain to authenticate on. Often it's the same as netbios host. |
| login | The user to login as. |
| password | the user's password. |
| int smb_session_state | ( | smb_session * | s | ) |
Returns the current state of the session.
| int smb_session_supports | ( | smb_session * | s, |
| int | what | ||
| ) |
Check if a feature is supported/has been negociated with the server.
| s | The session object |
| what | Which features to check ? |
1.8.8