else if (r > 0)
RETURN_NONE;
else
- rc = PyString_FromString(buf);
+ rc = BIN_FROMSTR(buf);
end:
return (rc);
}
char *tag;
char *phrase;
- if (!PyArg_ParseTuple(arg, "ss:set", &tag, &phrase))
+ if (!PyArg_ParseTuple(arg, "s"Y":set", &tag, &phrase))
return (0);
pixie_set(PIXIE_FD(me), tag, phrase);
RETURN_ME;
};
static const PyTypeObject pixie_pytype_skel = {
- PyObject_HEAD_INIT(0) 0, /* Header */
+ PyVarObject_HEAD_INIT(0, 0) /* Header */
"Pixie", /* @tp_name@ */
sizeof(pixie_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
/*----- Main code ---------------------------------------------------------*/
+static const struct nameval consts[] = {
+ CONST(PMODE_READ), CONST(PMODE_VERIFY),
+ { 0 }
+};
+
static PyObject *meth_ppread(PyObject *me, PyObject *arg, PyObject *kw)
{
char *tag;
goto end;
if (passphrase_read(tag, f, buf, sizeof(buf)))
SYSERR("passphrase read failed");
- rc = PyString_FromString(buf);
+ rc = BIN_FROMSTR(buf);
end:
return (rc);
}
goto end;
if (pixie_getpass(prompt, buf, sizeof(buf)))
OSERR(0);
- rc = PyString_FromString(buf);
+ rc = BIN_FROMSTR(buf);
end:
return (rc);
}
void passphrase_pyinsert(PyObject *mod)
{
INSERT("Pixie", pixie_pytype);
+ setconstants(mod, consts);
}
/*----- That's all, folks -------------------------------------------------*/