## Network Passwords

Network Passwords — Saving of network passwords.

## Synopsis

                        MateKeyringNetworkPasswordData;
    void                mate_keyring_network_password_free (MateKeyringNetworkPasswordData *data);
    void                mate_keyring_network_password_list_free
                                                            (GList *list);
    gpointer            mate_keyring_find_network_password (const char *user,
                                                             const char *domain,
                                                             const char *server,
                                                             const char *object,
                                                             const char *protocol,
                                                             const char *authtype,
                                                             guint32 port,
                                                             MateKeyringOperationGetListCallback callback,
                                                             gpointer data,
                                                             GDestroyNotify destroy_data);
    MateKeyringResult  mate_keyring_find_network_password_sync
                                                            (const char *user,
                                                             const char *domain,
                                                             const char *server,
                                                             const char *object,
                                                             const char *protocol,
                                                             const char *authtype,
                                                             guint32 port,
                                                             GList **results);
    gpointer            mate_keyring_set_network_password  (const char *keyring,
                                                             const char *user,
                                                             const char *domain,
                                                             const char *server,
                                                             const char *object,
                                                             const char *protocol,
                                                             const char *authtype,
                                                             guint32 port,
                                                             const char *password,
                                                             MateKeyringOperationGetIntCallback callback,
                                                             gpointer data,
                                                             GDestroyNotify destroy_data);
    MateKeyringResult  mate_keyring_set_network_password_sync
                                                            (const char *keyring,
                                                             const char *user,
                                                             const char *domain,
                                                             const char *server,
                                                             const char *object,
                                                             const char *protocol,
                                                             const char *authtype,
                                                             guint32 port,
                                                             const char *password,
                                                             guint32 *item_id);

## Description

Networks passwords are a simple way of saving passwords associated with a certain user/server/protocol and other fields.

## Details

### MateKeyringNetworkPasswordData

    typedef struct {
    	char *keyring;
    	guint32 item_id;

    	char *protocol;
    	char *server;
    	char *object;
    	char *authtype;
    	guint32 port;

    	char *user;
    	char *domain;
    	char *password;
    } MateKeyringNetworkPasswordData;

### mate_keyring_network_password_free ()

    void                mate_keyring_network_password_free (MateKeyringNetworkPasswordData *data);

Free a network password data pointer. If `NULL` is passed in, nothing happens.

`data` : | A MateKeyringNetworkPasswordData pointer.

### mate_keyring_network_password_list_free ()

    void                mate_keyring_network_password_list_free
                                                            (GList *list);

Free a list of network password data.

`list` : | A list of MateKeyringNetworkPasswordData pointers.

### mate_keyring_find_network_password ()

    gpointer            mate_keyring_find_network_password (const char *user,
                                                             const char *domain,
                                                             const char *server,
                                                             const char *object,
                                                             const char *protocol,
                                                             const char *authtype,
                                                             guint32 port,
                                                             MateKeyringOperationGetListCallback callback,
                                                             gpointer data,
                                                             GDestroyNotify destroy_data);

Find a previously stored network password. Searches all keyrings.

A `GList` of MateKeyringNetworkPasswordData structures are passed to the `callback`. The list and structures are freed after the callback returns.

The user may have been prompted to unlock necessary keyrings, and user will have been prompted for access to the items if needed.

Network passwords are items with the item type `MATE_KEYRING_ITEM_NETWORK_PASSWORD`

`user` : | The user name or `NULL` for any user.
`domain` : | The domain name `NULL` for any domain.
`server` : | The server or `NULL` for any server.
`object` : | The remote object or `NULL` for any object.
`protocol` : | The network protorol or `NULL` for any protocol.
`authtype` : | The authentication type or `NULL` for any type.
`port` : | The network port or zero for any port.
`callback` : | Callback which is called when the operation completes
`data` : | Data to be passed to callback
`destroy_data` : | Function to be called when data is no longer needed.
Returns : | The asychronous request, which can be passed to `mate_keyring_cancel_request()`.

### mate_keyring_find_network_password_sync ()

    MateKeyringResult  mate_keyring_find_network_password_sync
                                                            (const char *user,
                                                             const char *domain,
                                                             const char *server,
                                                             const char *object,
                                                             const char *protocol,
                                                             const char *authtype,
                                                             guint32 port,
                                                             GList **results);

Find a previously stored network password. Searches all keyrings.

A `GList` of MateKeyringNetworkPasswordData structures are returned in the `out_list` argument. The list should be freed with `mate_keyring_network_password_list_free()`

The user may have been prompted to unlock necessary keyrings, and user will have been prompted for access to the items if needed.

Network passwords are items with the item type `MATE_KEYRING_ITEM_NETWORK_PASSWORD`

`user` : | The user name or `NULL`.
`domain` : | The domain name `NULL`.
`server` : | The server or `NULL`.
`object` : | The remote object or `NULL`.
`protocol` : | The network protorol or `NULL`.
`authtype` : | The authentication type or `NULL`.
`port` : | The network port or zero.
`results` : | A location to return a `GList` of MateKeyringNetworkPasswordData pointers.
Returns : | `MATE_KEYRING_RESULT_OK` if the operation was succcessful or an error result otherwise.

### mate_keyring_set_network_password ()

    gpointer            mate_keyring_set_network_password  (const char *keyring,
                                                             const char *user,
                                                             const char *domain,
                                                             const char *server,
                                                             const char *object,
                                                             const char *protocol,
                                                             const char *authtype,
                                                             guint32 port,
                                                             const char *password,
                                                             MateKeyringOperationGetIntCallback callback,
                                                             gpointer data,
                                                             GDestroyNotify destroy_data);

Store a network password.

If an item already exists for with this network info (ie: user, server etc...) then it will be updated.

Whether a new item is created or not, id of the item will be passed to the `callback`.

Network passwords are items with the item type `MATE_KEYRING_ITEM_NETWORK_PASSWORD`

`keyring` : | The keyring to store the password in, or `NULL` for the default keyring.
`user` : | The user name or `NULL`.
`domain` : | The domain name `NULL`.
`server` : | The server or `NULL`.
`object` : | The remote object or `NULL`.
`protocol` : | The network protorol or `NULL`.
`authtype` : | The authentication type or `NULL`.
`port` : | The network port or zero.
`password` : | The password to store, must not be `NULL`.
`callback` : | Callback which is called when the operation completes
`data` : | Data to be passed to callback
`destroy_data` : | Function to be called when data is no longer needed.
Returns : | The asychronous request, which can be passed to `mate_keyring_cancel_request()`.

### mate_keyring_set_network_password_sync ()

    MateKeyringResult  mate_keyring_set_network_password_sync
                                                            (const char *keyring,
                                                             const char *user,
                                                             const char *domain,
                                                             const char *server,
                                                             const char *object,
                                                             const char *protocol,
                                                             const char *authtype,
                                                             guint32 port,
                                                             const char *password,
                                                             guint32 *item_id);

Store a network password.

If an item already exists for with this network info (ie: user, server etc...) then it will be updated.

The created or updated item id will be returned in `item_id`.

Network passwords are items with the item type `MATE_KEYRING_ITEM_NETWORK_PASSWORD`

`keyring` : | The keyring to store the password in, or `NULL` for the default keyring.
`user` : | The user name or `NULL`.
`domain` : | The domain name `NULL`.
`server` : | The server or `NULL`.
`object` : | The remote object or `NULL`.
`protocol` : | The network protorol or `NULL`.
`authtype` : | The authentication type or `NULL`.
`port` : | The network port or zero.
`password` : | The password to store, must not be `NULL`.
`item_id` : | A location to store the resulting item's id.
Returns : | `MATE_KEYRING_RESULT_OK` if the operation was succcessful or an error result otherwise.