~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ec.c: Reject strings with trailing junk in the curve-point constructor.
[catacomb-python]
/
passphrase.c
diff --git
a/passphrase.c
b/passphrase.c
index
d7baf74
..
424bcc9
100644
(file)
--- a/
passphrase.c
+++ b/
passphrase.c
@@
-92,7
+92,7
@@
static PyObject *pixmeth_read(PyObject *me, PyObject *arg, PyObject *kw)
else if (r > 0)
RETURN_NONE;
else
else if (r > 0)
RETURN_NONE;
else
- rc =
PyString_FromString
(buf);
+ rc =
BIN_FROMSTR
(buf);
end:
return (rc);
}
end:
return (rc);
}
@@
-102,7
+102,7
@@
static PyObject *pixmeth_set(PyObject *me, PyObject *arg)
char *tag;
char *phrase;
char *tag;
char *phrase;
- if (!PyArg_ParseTuple(arg, "s
s
:set", &tag, &phrase))
+ if (!PyArg_ParseTuple(arg, "s
"Y"
:set", &tag, &phrase))
return (0);
pixie_set(PIXIE_FD(me), tag, phrase);
RETURN_ME;
return (0);
pixie_set(PIXIE_FD(me), tag, phrase);
RETURN_ME;
@@
-127,8
+127,8
@@
static const PyMethodDef pixie_pymethods[] = {
{ 0 }
};
{ 0 }
};
-static PyTypeObject pixie_pytype_skel = {
- Py
Object_HEAD_INIT(0) 0,
/* Header */
+static
const
PyTypeObject pixie_pytype_skel = {
+ Py
VarObject_HEAD_INIT(0, 0)
/* Header */
"Pixie", /* @tp_name@ */
sizeof(pixie_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
"Pixie", /* @tp_name@ */
sizeof(pixie_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
@@
-177,6
+177,11
@@
static PyTypeObject pixie_pytype_skel = {
/*----- Main code ---------------------------------------------------------*/
/*----- 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;
static PyObject *meth_ppread(PyObject *me, PyObject *arg, PyObject *kw)
{
char *tag;
@@
-190,7
+195,7
@@
static PyObject *meth_ppread(PyObject *me, PyObject *arg, PyObject *kw)
goto end;
if (passphrase_read(tag, f, buf, sizeof(buf)))
SYSERR("passphrase read failed");
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);
}
end:
return (rc);
}
@@
-215,7
+220,7
@@
static PyObject *meth_getpass(PyObject *me, PyObject *arg)
goto end;
if (pixie_getpass(prompt, buf, sizeof(buf)))
OSERR(0);
goto end;
if (pixie_getpass(prompt, buf, sizeof(buf)))
OSERR(0);
- rc =
PyString_FromString
(buf);
+ rc =
BIN_FROMSTR
(buf);
end:
return (rc);
}
end:
return (rc);
}
@@
-238,6
+243,7
@@
void passphrase_pyinit(void)
void passphrase_pyinsert(PyObject *mod)
{
INSERT("Pixie", pixie_pytype);
void passphrase_pyinsert(PyObject *mod)
{
INSERT("Pixie", pixie_pytype);
+ setconstants(mod, consts);
}
/*----- That's all, folks -------------------------------------------------*/
}
/*----- That's all, folks -------------------------------------------------*/