int main(int argc, char *argv[]){ char oldpss[30]; char newpss[30]; char msg[20]; strcpy(msg,"Old password: "******"New password: "******"Usage: passwd program needs a user in the first argument\n"); exit(); } if(user_exist(argv[1])){ while(getcmd(oldpss, sizeof(oldpss),msg) >= 0){ break; } oldpss[strlen(oldpss)-1]='\0'; while(getcmd(newpss, sizeof(newpss),msg1) >= 0){ break; } newpss[strlen(newpss)-1]='\0'; changepasswd( argv[1],oldpss,newpss); } exit(); }
mainwindow::mainwindow() { // Interface Construction ui.setupUi(this); pt_mth = pt_type = -1; evt = isreset = 1; pdfpath = "./PDF/"; lstroll = ""; dt = QDate::currentDate().toString("dd.MM.yyyy"); ui.date->setText(dt); mwsdt = new sdetails(); // Scene Construction setdmscene(); // Load Modules btable = new bulkprint(this,ui.tab_5); btable->show(); selprint = new selectiveprint(this); setupmenu(); // Start the Authentication Dialog AuthenDialog *authendialog = new AuthenDialog(this); authendialog->show(); // Printer Info QPrinter print; QPrinterInfo pinfo(print); ui.pinfo->setText(pinfo.printerName());//.section("",-1,-1)); // Fetch Printing Positions QFile file2("./positions.dat"); file2.open(QIODevice::ReadOnly); QDataStream inp(&file2); inp >> lt; //set printer setprinter(); //Connections connect(ui.bselback,SIGNAL(pressed()),selprint,SLOT(back())); connect(ui.bqreset,SIGNAL(pressed()),this,SLOT(breset())); connect(ui.bqprint,SIGNAL(pressed()),this,SLOT(qprint())); connect(ui.bbulkprintall,SIGNAL(pressed()),this,SLOT(bprintall())); connect(ui.bbulkselprint,SIGNAL(pressed()),this,SLOT(bprintsel())); connect(ui.bselnext,SIGNAL(released()),selprint,SLOT(next())); connect(ui.babortprint,SIGNAL(released()),this,SLOT(abortprint())); connect(ui.bpositions,SIGNAL(released()),this,SLOT(positionsdialog())); connect(ui.changeButton,SIGNAL(released()),this,SLOT(changepasswd())); connect(ui.leqroll,SIGNAL(textChanged(const QString &)),this,SLOT(rollchanged(const QString &))); connect(ui.leqsname,SIGNAL(textChanged(const QString &)),this,SLOT(snamechanged(const QString &))); connect(ui.leqfname,SIGNAL(textChanged(const QString &)),this,SLOT(fnamechanged(const QString &))); connect(ui.cbcourse,SIGNAL(currentIndexChanged(const QString &)),this,SLOT(coursechanged(const QString &))); connect(ui.cbbranch,SIGNAL(currentIndexChanged(const QString &)),this,SLOT(branchchanged(const QString &))); connect(ui.cbyear,SIGNAL(currentIndexChanged(const QString &)),this,SLOT(yearchanged(const QString &))); connect(ui.cbsem,SIGNAL(currentIndexChanged(const QString &)),this,SLOT(semchanged(const QString &))); //connect(ui.cbpl,SIGNAL(currentIndexChanged(const QString &)),this,SLOT(ptchanged(const QString &))); connect(ui.leqfrom,SIGNAL(textChanged(const QString &)),this,SLOT(fromchanged(const QString &))); connect(ui.leqto,SIGNAL(textChanged(const QString &)),this,SLOT(tochanged(const QString &))); connect(ui.lepurpose,SIGNAL(textChanged(const QString &)),this,SLOT(ppchanged(const QString &))); connect(ui.cbgen,SIGNAL(currentIndexChanged(int)),this,SLOT(genchanged(int))); connect(ui.modetab,SIGNAL(currentChanged(int)),this,SLOT(pmode(int))); connect(ui.ptcombo,SIGNAL(currentIndexChanged(QString)),ui.ltype,SLOT(setText(const QString &))); connect(ui.outbox,SIGNAL(currentIndexChanged(QString)),ui.lout,SLOT(setText(const QString &))); connect(ui.gbcno,SIGNAL(toggled(bool)),this,SLOT(cidtoggle(bool))); connect(ui.sbcno,SIGNAL(valueChanged (int)),this,SLOT(cidvalue(int))); connect(ui.actionQuit,SIGNAL(triggered()),this,SLOT(close())); connect(ui.actionAbout,SIGNAL(triggered()),this,SLOT(about_p())); connect(actionselprintall,SIGNAL(triggered()),selprint,SLOT(printall())); connect(actionselprintsel,SIGNAL(triggered()),selprint,SLOT(printsel())); connect(ui.actionPrint,SIGNAL(triggered()),this,SLOT(qprint())); connect(ui.actionReset,SIGNAL(triggered()),this,SLOT(reset())); ui.leqroll->setFocus(); ui.lepurpose->setText("Bus Pass"); qp1 = "select STUDENT_ID from student_admission where STUDENT_ROLLNO="; qp2 = "select student_name,father_name,gender from student_info where student_id=" ; qp3 = "select course,branch_id,current_sem,current_year from student_academic where student_id=" ; }
void main(int argc, char *argv[]) { char buf[TICKREQLEN]; Ticketreq tr; ARGBEGIN{ case 'd': debug++; }ARGEND strcpy(raddr, "unknown"); if(argc >= 1) getraddr(argv[argc-1]); alarm(10*60*1000); /* kill a connection after 10 minutes */ db = ndbopen("/lib/ndb/auth"); if(db == 0) syslog(0, AUTHLOG, "no /lib/ndb/auth"); srand(time(0)*getpid()); for(;;){ if(readn(0, buf, TICKREQLEN) <= 0) exits(0); convM2TR(buf, &tr); switch(buf[0]){ case AuthTreq: ticketrequest(&tr); break; case AuthChal: challengebox(&tr); break; case AuthPass: changepasswd(&tr); break; case AuthApop: apop(&tr, AuthApop); break; case AuthChap: chap(&tr); break; case AuthMSchap: mschap(&tr); break; case AuthCram: apop(&tr, AuthCram); break; case AuthHttp: http(&tr); break; case AuthVNC: vnc(&tr); break; default: syslog(0, AUTHLOG, "unknown ticket request type: %d", buf[0]); exits(0); } } /* not reached */ }