dp_auth_util.c revision 1b18a3fc310932e5afcdaa4bb401c8d368e79c0b
/*
SSSD
Data Provider, auth utils
Copyright (C) Sumit Bose <sbose@redhat.com> 2009
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "data_provider.h"
{
int ret;
(pd->authtok_size),
&(pd->newauthtok),
return ret;
}
{
int ret;
&(pd->authtok_size),
&(pd->newauthtok),
&(pd->newauthtok_size),
return ret;
}
{
struct response_data *resp;
/* Append the PAM status */
if (!dbret) {
return false;
}
/* Create an array of response structures */
DBUS_TYPE_ARRAY, "(uay)",
&array_iter);
if (!dbret) {
return false;
}
/* Create a DBUS struct */
&struct_iter);
if (!dbret) {
return false;
}
/* Add the response type */
if (!dbret) {
return false;
}
/* Add the response message */
DBUS_TYPE_ARRAY, "y",
&data_iter);
if (!dbret) {
return false;
}
if (!dbret) {
return false;
}
if (!dbret) {
return false;
}
if (!dbret) {
return false;
}
}
/* Close the struct array */
if (!dbret) {
return false;
}
return true;
}
{
int type;
int len;
return false;
}
return false;
}
if (!dbus_message_iter_next(&iter)) {
return false;
}
/* After this point will be an array of pam data */
return false;
}
return false;
}
/* Read in a pam data struct */
return false;
}
/* PAM data struct contains a type and a byte-array of data */
/* Get the pam data type */
return false;
}
if (!dbus_message_iter_next(&struct_iter)) {
return false;
}
/* Get the byte array */
return false;
}
}
return true;
}
{
int type;
if (!reply) {
/* reply should never be null. This function shouldn't be called
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
DEBUG(0, ("Severe error. A reply callback was called but no"
" reply was received and no timeout occurred\n"));
/* FIXME: Destroy this connection ? */
goto done;
}
switch (type) {
if (!ret) {
/* FIXME: Destroy this connection ? */
goto done;
}
break;
case DBUS_MESSAGE_TYPE_ERROR:
DEBUG(0,("The Monitor returned an error [%s]\n",
/* Falling through to default intentionally*/
default:
/*
* Timeout or other error occurred or something
* unexpected happened.
* It doesn't matter which, because either way we
* know that this connection isn't trustworthy.
* We'll destroy it now.
*/
/* FIXME: Destroy this connection ? */
break;
}
done:
}
const char *name)
{
int retval;
/* create the message */
DEBUG(0, ("Out of memory?!\n"));
return ENOMEM;
}
if (!ret) {
return EIO;
}
return retval;
}